Cold backup script
For
testing and development DB, it’ archive mode is noarchivelog, and it can be
closed on non-working time.
We can
use closed database backup.it have following advantages:
• Conceptually simple
• Easy to perform
• Require little operator
interaction
---------
backup mutiple backup sets by date dirctory ---------------
#!/bin/bash
## set
enviroment variable
ORACLE_SID=shenzhen
ORACLE_HOME=/u01/oracle
ORACLE_BASE=/u01
NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export
ORACLE_SID ORACLE_HOME ORACLE_BASE NLS_LANG
## set
the backup directory
backdate=`date
-u +%Y%m%d`
backupdir=/u01/backup/cold/$backdate
mkdir -p
$backupdir
echo
"**************************************"
echo
"* cold_backup.sh
"
echo
"**************************************"
$ORACLE_HOME/bin/sqlplus
-s "/ as sysdba" << EOF
set
feedback off heading off verify off trimspool off
set
pagesize 0 linesize 200
-- Set
SQL*Plus user variables used in this script
define
fil='/u01/workarea/cold_backup.sql'
prompt
... spooling to &fil
--
Create Backup command
spool
&fil
select 'host cp ' || name ||' $backupdir'
from v$datafile;
select 'host cp ' || member || ' $backupdir'
from v$logfile;
select 'host cp ' || name || ' $backupdir'
from v$controlfile;
select 'host cp $ORACLE_HOME/dbs/spfileshenzhen.ora
$ORACLE_HOME/dbs/orapwshenzhen $backupdir' from dual;
spool
off;
--
Shutdown Database
shutdown
immediate;
@
&fil
startup;
exit
EOF
------------------------ backup keeping only one backup set ---------
#!/bin/bash
## set
enviroment variable
ORACLE_SID=shenzhen
ORACLE_HOME=/u01/oracle
ORACLE_BASE=/u01
NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export
ORACLE_SID ORACLE_HOME ORACLE_BASE NLS_LANG
echo
"**************************************"
echo
"* cold_backup.sh "
echo
"**************************************"
$ORACLE_HOME/bin/sqlplus
-s "/ as sysdba" << EOF
set
feedback off heading off verify off trimspool off
set
pagesize 0 linesize 200
-- Set
SQL*Plus user variables used in this script
define
dir='/u01/backup/cold/'
define
fil='/u01/workarea/cold_backup.sql'
prompt
... spooling to &fil
--
Create Backup command
spool
&fil
select 'host cp ' || name ||' &dir' from
v$datafile;
select 'host cp ' || member || ' &dir'
from v$logfile;
select 'host cp ' || name || ' &dir' from
v$controlfile;
select 'host cp
$ORACLE_HOME/dbs/spfileshenzhen.ora $ORACLE_HOME/dbs/orapwshenzhen &dir'
from dual;
spool
off;
--
Shutdown Database
shutdown
immediate;
@
&fil
startup;
exit
EOF
Reference : http://huiyisky.itpub.net/
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12472709/viewspace-1037121/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Cold Database backup scriptDatabase
- oracle cold backup scriptsOracle
- Cold backup and restore the entire databaseRESTDatabase
- rman backup script(引用)
- oracle 11g rman backup scriptOracle
- RMAN Backup Shell Script Example (Doc ID 137181.1)
- Nothing lasts forever, Even cold November rainASTAI
- Cold_Chair OI 時期出題集錦AI
- Script
- 請說說`<script>`、`<script async>`和`<script defer>`的區別
- Script Browser & Script Analyzer 1.3更新發布
- Shell Script
- shell script
- oracle scriptOracle
- script win
- bat scriptBAT
- full backup 與 level 0 incremental backupREM
- script標籤
- [Oracle Script] LockOracle
- Tablespace Space Script
- Oracle Database ScriptOracleDatabase
- tom's script
- Shell Script(轉)
- Veritas Backup
- 2008 5.9:I think i'm coming down with a cold
- ORA-600(1403)和ORA-7445($cold_kslgetsl)錯誤
- QlikView Script – 進階篇1 Script呼叫Macro之變化ViewMac
- MySQL Server Startup ScriptMySqlServer
- npm script中&&和&NPM
- Elasticsearch script sort 排序Elasticsearch排序
- JavaScript <script>標籤JavaScript
- [Oracle Script] Top sqlOracleSQL
- script error總結Error
- script元素屬性
- [Oracle Script] check userOracle
- [Oracle Script] check latchOracle
- how to use coffee script
- Script form where usedORM