- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Need help with Oracle and UNIX shell scripts
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2004 06:11 AM
тАО12-29-2004 06:11 AM
Need help with Oracle and UNIX shell scripts
(c) Copyright 2000 Oracle Corporation. All rights reserved.
Connected.
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.5.0 - Production
SQL*Plus: Release 8.1.7.0.0 - Production on Wed Dec 29 13:57:39 2004
(c) Copyright 2000 Oracle Corporation. All rights reserved.
SP2-0734: unknown command beginning "user..." - rest of line ignored.
#!/usr/bin/ksh
. /data/oracle/.profile
. /data/oracle/.kshrc
ORACLE_SID=SID
export ORACLE_SID
REPORT_DIR=/data/oracle/output/${ORACLE_SID}/
export REPORT_DIR
cd /data/oracle/scripts/${ORACLE_SID}/
sqlplus /nolog @create_variables.sql ${REPORT_DIR}
chmod 700 set_os_date_variables_${ORACLE_SID}.sh
chmod 600 define_sqlplus_variables_${ORACLE_SID}.sql
. set_os_date_variables_${ORACLE_SID}.sh
sqlplus /nolog @master${ORACLE_SID}.sql
chgrp monit ${REPORT_DIR}r${TODAY}*
chmod o-rwx ${REPORT_DIR}r${TODAY}*
====================================================
connect.sql
===========================================
connect user/password@SID
==============================
create_variables.sql
==============================
@@connect.sql
set feedback off
set linesize 200
set pagesize 0
set heading off
set echo off
set termout off
set timing off
set verify off
set trimspool on
spool set_os_date_variables_${ORACLE_SID}.sh
--
select '#!/usr/bin/ksh' from dual;
select '# This file created dynamically by create_environmental_variables_scripts.sql' from dual;
select 'TODAY=' || to_char(sysdate, 'YYYY_MM_DD') from dual;
select 'export TODAY' from dual;
select 'YESTERDAY=' || to_char(sysdate - 1, 'YYYY_MM_DD') from dual;
select 'export YESTERDAY' from dual;
spool off
--!chmod 700 set_os_date_variables_${ORACLE_SID}.sh
spool define_sqlplus_variables_${ORACLE_SID}.sql
SELECT 'DEFINE TODAY = ' || '''' || TO_CHAR(SYSDATE, 'YYYY_MM_DD') || '''' FROM DUAL;
select 'DEFINE ORACLE_SID = ' || UPPER(INSTANCE_NAME) FROM SYS.V_$INSTANCE;
select 'DEFINE REPORT_DIR = ' || '''' || '&1' || '''' FROM DUAL;
spool off
--!chmod 600 define_sqlplus_variables_${ORACLE_SID}.sql
exit
- Tags:
- SQL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2004 07:43 AM
тАО12-29-2004 07:43 AM
Re: Need help with Oracle and UNIX shell scripts
Do the same versions of sqlplus work for both databases that are as different as these two?
Just a thought, but the authentication may have changed from version to version.
We mirgrated from 8.1.7 to 9.2.0.4 but use different ORACLE_HOME directories and therefore different binaries to actually access the data and run sql.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2004 09:56 AM
тАО12-29-2004 09:56 AM
Re: Need help with Oracle and UNIX shell scripts
So you are connecting an 8.1.7 SQlplus client to a 9i server. You may want to consider to upgrade, but it should not influence your problem.
It seems like a round-about way, going in and out through SQPlus to set up stuff that can all be done from the shell. Please consider that for you own sanity?
Anyway, did this setup ever work? What changed?
If you run the .sql scripts manually, one at a time do they work?
Is that username still valid?
hope this helps some,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2004 11:57 AM
тАО12-29-2004 11:57 AM
Re: Need help with Oracle and UNIX shell scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-29-2004 02:00 PM
тАО12-29-2004 02:00 PM
Re: Need help with Oracle and UNIX shell scripts
> ORACLE_SID=SID
> export ORACLE_SID
The reason is that ORACLE_SID will contain the 3 characters "SID" and not the contents of a variable called SID. It should probably read:
ORACLE_SID=$SID
export ORACLE_SID
or in ksh or POSIX sh, you can simplify this to:
export ORACLE_SID=$SID
Bill Hassell, sysadmin