Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Backup Script
On 6 Aug 2003 12:04:25 -0700, hari_om_at_hotmail.com (Hari Om) wrote:
>I have a question on the Cold Backup Scripts. I was reading a book and
>it showed how to use scripts to automate BACKUP. Here is a sample:
>--------------------------------------------------------------------
>#!/bin/ksh
>ORACLE_SID=$1
>export ORACLE_SID
>export ORAENV_ASK=NO
>BACKUP_DIR=/test01/app/oracle
>. oraenv
>sqlplus -s system/remorse << EOF
>set head off feed off echo off trimspool on linesize 200
>spool /u01/app/oracle/dba/cold_backup.ksh
>select 'cp' || file_name || '{$BACKUP_DIR}' from sys.dba_data_files;
>select 'cp' || name || '{$BACKUP_DIR}' from v$controlfile;
>select 'cp' || member || '{$BACKUP_DIR}' from v$logfile;
>spool off;
>exit;
>EOF
>--------------------------------------------------------------------
>
>My question is with reference to line 6 (. oraenv) and Line 7
>(sqlplus...)
>What does Line 6 do? What is . oraenv used for?
>What does SQLPLUS with '-s" option do?
>
>I am a newbie and so please excuse my ignorance on this topic. Where
>can I find more startup scripts on Oracle DB?
>
>Thanks!
Your first question is a unix question, not Oracle. But the answer, from "Learning the Korn Shell" is the dot "causes the commands in the script to be read and run as if you typed them in.
The answer to the second question is found in the "SQL*Plus User's Guide and Reference " found at tahiti.oracle.com. Received on Wed Aug 06 2003 - 15:28:07 CDT