Sponsored Content
Special Forums UNIX and Linux Applications Identify a specific environment Oracle variable to connect a remote Oracle database ? Post 302922524 by jim mcnamara on Saturday 25th of October 2014 11:59:02 PM
Old 10-26-2014
Not sure what you are seeing.

This is a complete oracle connect string for sqlplus:
Code:
sqlplus username/password@oracle_instance

The parts are
username - valid oracle user name for the instance
password - we have encrypted our passwords in the files, scripts and variables used to call
sqlplus scripts like pl/sql. They password is decrypted on the fly, so it never appear anywhere for prying eyes.
instance - there must be a tnsnames.ora file in a special directory that specifies the instances and how to connect to them, sometimes there are also aliases for instances.

If you define the ORACLE_SID variable all is does is to remove the need for specifying the instance.

If you need to get in to oracle, contact your DBA for help, the way you are going will not get you far. If you are root on the system, then there are ways to connect to oracle as the sysdba user by becoming the oracle on the server that runs the database and
use connect / as sysdba in sqlplus.

The real question with your limited level of oracle knowledge is: why are you trying to get logged in without going the usual way -> your manager clears it & DBA sets up your account?
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to COnnect to Oracle database from UNIX Box

I am trying to connect to Oracle Databse from UNIX box using sqlplus command. But i get sqplus not found message. $ sqlplus sqlplus: not found I have searched in forums and all are suggesting to set environment varaibles...can somebody tell me what variables to set and how to set.and the... (12 Replies)
Discussion started by: angelarosh
12 Replies

2. UNIX for Dummies Questions & Answers

Shell scripting+connect to oracle database+spooling

Hi! Everyone I am new to the shell scripting basically.I have been asked to create a shell script that connect to a oracle database to read data from a particular schema then spool it into a csv file then email to customer. Can anybody let me know how to go about that. I have create... (14 Replies)
Discussion started by: Mr Mo
14 Replies

3. Shell Programming and Scripting

Perl connect to remote oracle db without local oracle installation

I want to use Perl to connect to a remote Oracle DB I have no oracle installation on my server (and dont plan on installing one) I am using solaris 9 on x86 server. Is this possible? I basically want to run some basic sql queries on the remote oracle db which I have access to using perl on my... (0 Replies)
Discussion started by: frustrated1
0 Replies

4. Shell Programming and Scripting

How to connect with oracle database using unix...

Hi all I am working in datawarehouse project and use DB2 database . shell scripting is written to connect with DB2 database in my application but i dont know how to connect with oracle databse or other databases.Is there any command in unix to connect any of these datbases? (6 Replies)
Discussion started by: vijays3
6 Replies

5. Shell Programming and Scripting

Korn Script to connect and query oracle database

I've been sent the following script to finish. It's supposed to connect to an oracle database, query it, and send an email if the query result value is one or more. Currently it isn't connecting properly, just giving the following error: ERROR: ORA-01017: invalid username/password; logon denied... (2 Replies)
Discussion started by: jackmorgan2007
2 Replies

6. Shell Programming and Scripting

Shell Script to connect to the oracle database

Hi Unix Gurus, I have a requirement to write a script, Oracle DB gets referesh every 6hrs, hence we need write a script to connect to the database , if it connects it should generate a file to proceed the next job application or when an error when connectiong to DB it should not generate any... (8 Replies)
Discussion started by: bshivali
8 Replies

7. Shell Programming and Scripting

How to connect to Oracle database using shell script?

Hi All, I am newbie to unix shell scripting. I want to connect to oracle database using shell script. I know how to connect DB using user name and password but my question is if my password is having '@' sign then how to connect. I have tried like below, cnt=`sqlplus -s /nolog << EOFSQL ... (3 Replies)
Discussion started by: pmotewar
3 Replies

8. Shell Programming and Scripting

Connect to Oracle database with JDBC drivers.

Hi All, We are having LINUX server. I would like to connect to oracle database from server to with the help of shell script and execute a procedure. We dont have oracle installed to use sqlplus and connect to database. Do we have any command to connect to database using JDBC drivers. ... (1 Reply)
Discussion started by: Girish19
1 Replies

9. Shell Programming and Scripting

Connect to Oracle database

could someone please help me in shell scripting. i want to connect to oracle database which is on remote sever. requirement: 1 want to check files in source directory if file exist then a execute a corresponding batch jobs on unix sever and fetch data from oracle database which is on remote... (2 Replies)
Discussion started by: refi123
2 Replies
OCI_NEW_CONNECT(3)														OCI_NEW_CONNECT(3)

oci_new_connect - Connect to the Oracle server using a unique connection

SYNOPSIS
resource oci_new_connect (string $username, string $password, [string $connection_string], [string $character_set], [int $ses- sion_mode]) DESCRIPTION
Establishes a new connection to an Oracle server and logs on. Unlike oci_connect(3) and oci_pconnect(3), oci_new_connect(3) does not cache connections and will always return a brand-new freshly opened connection handle. This is useful if your application needs transactional isolation between two sets of queries. PARAMETERS
o $username - The Oracle user name. o $password - The password for $username. o $connection_string -Contains the Oracle instance to connect to. It can be an Easy Connect string, or a Connect Name from the tnsnames.ora file, or the name of a local Oracle instance. If not specified, PHP uses environment variables such as TWO_TASK (on Linux) or LOCAL (on Windows) and ORACLE_SID to determine the Oracle instance to connect to. To use the Easy Connect naming method, PHP must be linked with Oracle 10 g or greater Client libraries. The Easy Connect string for Oracle 10 g is of the form: [//]host_name[:port][/ser- vice_name]. From Oracle 11 g, the syntax is: [//]host_name[:port][/service_name][:server_type][/instance_name]. Service names can be found by running the Oracle utility lsnrctl status on the database server machine. The tnsnames.ora file can be in the Oracle Net search path, which includes $ORACLE_HOME/network/admin and /etc. Alternatively set TNS_ADMIN so that $TNS_ADMIN/tnsnames.ora is read. Make sure the web daemon has read access to the file. o $character_set -Determines the character set used by the Oracle Client libraries. The character set does not need to match the character set used by the database. If it doesn't match, Oracle will do its best to convert data to and from the database character set. Depending on the character sets this may not give usable results. Conversion also adds some time overhead. If not specified, the Oracle Client libraries determine a character set from the NLS_LANG environment variable. Passing this parameter can reduce the time taken to connect. o $session_mode -This parameter is available since version PHP 5 (PECL OCI8 1.1) and accepts the following values: OCI_DEFAULT, OCI_SYSOPER and OCI_SYSDBA. If either OCI_SYSOPER or OCI_SYSDBA were specified, this function will try to establish privileged connection using external credentials. Privileged connections are disabled by default. To enable them you need to set oci8.privileged_connect to On. PHP 5.3 (PECL OCI8 1.3.4) introduced the OCI_CRED_EXT mode value. This tells Oracle to use External or OS authentication, which must be configured in the database. The OCI_CRED_EXT flag can only be used with username of "/" and a empty password. oci8.privileged_connect may be On or Off. OCI_CRED_EXT may be combined with the OCI_SYSOPER or OCI_SYSDBA modes. OCI_CRED_EXT is not supported on Windows for security reasons. RETURN VALUES
Returns a connection identifier or FALSE on error. EXAMPLES
The following demonstrates how you can separate connections. Example #1 oci_new_connect(3) example <?php // create table mytab (mycol number); function query($name, $c) { echo "Querying $name "; $s = oci_parse($c, "select * from mytab"); oci_execute($s, OCI_NO_AUTO_COMMIT); $row = oci_fetch_array($s, OCI_ASSOC); if (!$row) { echo "No rows "; } else { do { foreach ($row as $item) echo $item . " "; echo " "; } while (($row = oci_fetch_array($s, OCI_ASSOC)) != false); } } $c1 = oci_connect("hr", "welcome", "localhost/orcl"); $c2 = oci_new_connect("hr", "welcome", "localhost/orcl"); $s = oci_parse($c1, "insert into mytab values(1234)"); oci_execute($s, OCI_NO_AUTO_COMMIT); query("basic connection", $c1); query("new connection", $c2); oci_commit($c1); query("new connection after commit", $c2); // Output is: // Querying basic connection // 1234 // Querying new connection // No rows // Querying new connection after commit // 1234 ?> See oci_connect(3) for further examples of parameter usage. SEE ALSO
oci_connect(3), oci_pconnect(3). PHP Documentation Group OCI_NEW_CONNECT(3)
All times are GMT -4. The time now is 04:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy