Sponsored Content
Top Forums Shell Programming and Scripting Switching user to oracle to connect Oracle 11g DB with 'sysdba' Post 302628201 by NetBear on Monday 23rd of April 2012 05:25:16 AM
Old 04-23-2012
Question Switching user to oracle to connect Oracle 11g DB with 'sysdba'

I need to connect my Oracle 11g DB from shell script with 'sysdba' permissions. To do this I have to switch user from 'root' to 'oracle'.
I've tried the following with no success.

Code:
  su - oracle -c "<< EOF1
        sqlplus -s "/ as sysdba" << EOF2
        whenever sqlerror exit sql.sqlcode;
        set echo off 
        set heading off
    
        shutdown immediate
        startup mount
        alter database archivelog;
        alter database open;
        
        exit;
        EOF2
    EOF1"

I'm getting the following error.
Code:
> [root@vEMS-23 devel]# ./enableArchiveLogs.sh en ERROR: ORA-01031:
> insufficient privileges
> 
> 
> SP2-0306: Invalid option. Usage: CONN[ECT] [logon] [AS
> {SYSDBA|SYSOPER|SYSASM}] where <logon>  ::=
> <username>[/<password>][@<connect_identifier>] [edition=value] | /
> SP2-0306: Invalid option. Usage: CONN[ECT] [logon] [AS
> {SYSDBA|SYSOPER|SYSASM}] where <logon>  ::=
> <username>[/<password>][@<connect_identifier>] [edition=value] | /
> SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting
> SQL*Plus [root@vEMS-23 devel]#


As far as I may understand it fails to authenticate as 'sysdba'. It doesn't occurs if I eliminate 'su - oracle -c' and run script as an oracle user initially.


Any clues?
Thanks in advanced.

Last edited by radoulov; 04-23-2012 at 09:30 AM..
 

3 More Discussions You Might Find Interesting

1. Programming

Help on a perl script to connect to oracle ASM as sysdba

I am novice to perl. Can someone guide me on the below query. We have an existing perl script which connects to database to check the disk group status which i wanted to retieve directly from ASM rather than database. This is because, a cluster has more than 4 databases running and a check on... (0 Replies)
Discussion started by: sai_rsk
0 Replies

2. Shell Programming and Scripting

Use perl to connect to Oracle ASM as sysdba

I am novice to perl. Can someone guide me on the below query. We have an existing perl script which connects to database to check the disk group status which i wanted to retieve directly from ASM rather than database. This is because, a cluster has more than 4 databases running and a check on... (1 Reply)
Discussion started by: sai_rsk
1 Replies

3. UNIX and Linux Applications

Identify a specific environment Oracle variable to connect a remote Oracle database ?

Good evening I nned your help pls, In an unix server i want to connect to a remote oracle databse server by sqlplus. I tried to find out the user/passwd and service name by env variable and all Ive got is this: ORACLE_SID_REPCOL=SCL_REPCOL ORACLE_SID=xmeta ORACLE_SID_TOL=SCL_PROTOLCOL... (2 Replies)
Discussion started by: alexcol
2 Replies
PPPOE-CONNECT(8)					      System Manager's Manual						  PPPOE-CONNECT(8)

NAME
pppoe-connect - Shell script to manage a PPPoE link SYNOPSIS
pppoe-connect [config_file] pppoe-connect interface user [config_file] DESCRIPTION
pppoe-connect is a shell script which manages a PPPoE connection using the Roaring Penguin user-space PPPoE client. If you omit con- fig_file, the default file /etc/sysconfig/network-scripts/ifcfg-ppp0 is used. If you supply interface and user, then they override the Ethernet interface and user-name settings in the configuration file. Note that normally, you should not invoke pppoe-connect directly. Instead, use pppoe-start to bring up the PPPoE connection. pppoe-connect first reads a configuration file. It then brings up a PPPoE connection. If the connection ever drops, a message is logged to syslog, and pppoe-connect re-establishes the connection. In addition, each time the connection is dropped or cannot be established, pppoe-connect executes the script /etc/ppp/pppoe-lost if it exists and is executable. The shell script pppoe-stop causes pppoe-connect to break out of its loop, bring the connection down, and exit. TECHNICAL DETAILS
pppoe-connect uses the following shell variables from the configuration file: ETH The Ethernet interface connected to the DSL modem (for example, eth0). USER The PPPoE user-id (for example, b1xxnxnx@sympatico.ca). PIDFILE A file in which to write the process-ID of the pppoe-connect process (for example, /var/run/pppoe.pid). Two additional files ($PID- FILE.pppd and $PIDFILE.pppoe) hold the process-ID's of the pppd and pppoe processes, respectively. By using different configuration files with different PIDFILE settings, you can manage multiple PPPoE connections. Just specify the con- figuration file as an argument to pppoe-start and pppoe-stop. AUTHOR
pppoe-connect was written by David F. Skoll <dfs@roaringpenguin.com>. The pppoe home page is http://www.roaringpenguin.com/pppoe/. SEE ALSO
pppoe(8), pppoe-start(8), pppoe-stop(8), pppd(8), pppoe.conf(5), pppoe-setup(8), pppoe-status(8), pppoe-sniff(8), pppoe-server(8), pppoe- relay(8) 4th Berkeley Distribution 21 February 2000 PPPOE-CONNECT(8)
All times are GMT -4. The time now is 03:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy