1. Исходная промышленная СУБД (SPOD)
$ export ORACLE_SID=spod
$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.2.0 Production on Thu Sep 1 11:34:02 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u03/app/oradb/oradata/spod/system/system01.dbf
/u03/app/oradb/oradata/spod/sysaux/sysaux01.dbf
/u03/app/oradb/oradata/spod/undotbs/undotbs01.dbf
/u03/app/oradb/oradata/spod/users/users01.dbf
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
/u03/app/oradb/oradata/spod/temp/temp01.dbf
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u02/app/oradb/oradata/spod/redoa/redo01.log
/u02/app/oradb/oradata/spod/redoa/redo02.log
/u02/app/oradb/oradata/spod/redoa/redo03.log
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/u03/app/oradb/oradata/spod/control1/control01.ctl
/u03/app/oradb/oradata/spod/control2/control02.ctl
SQL> exit
$ strings spfilespod.ora
spod.__db_cache_size=1409286144
spod.__java_pool_size=16777216
spod.__large_pool_size=16777216
spod.__oracle_base='/u01/app'#ORACLE_BASE set from environment
spod.__pga_aggregate_target=1342177280
spod.__sga_target=2013265920
spod.__shared_io_pool_size=0
spod.__shared_pool_size=520093696
spod.__streams_pool_size=16777216
*.audit_file_dest='/u01/app/admin/spod/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u03/app/oradb/oradata/spod/control1/control01.ctl','/u03/app/oradb/oradata/spod/control2/control02.ctl'
*.db_block_size=8192
*.db_domain='oracle.sun.com'
*.db_name='spod'
*.db_recovery_file_dest='/u01/app/fast_recovery_area'
*.db_recovery_file_dest_size=5218762752
*.diagnostic_dest='/u01/app'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=spodXDB)'
*.log_archive_dest_1='LOCATION=/u01/app/oradb/archlogs/arch01/spod/'
*.log_archive_dest_2='LOCATION=/u01/app/oradb/archlogs/arch02/spod OPTIONAL'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
$
2. Создаем структуру каталогов для тестовой базы данных (SPODT2)
mkdir -p /u03/app/oradb/oradata/spodt2/system
mkdir -p /u03/app/oradb/oradata/spodt2/sysaux
mkdir -p /u03/app/oradb/oradata/spodt2/undotbs
mkdir -p /u03/app/oradb/oradata/spodt2/users
mkdir -p /u03/app/oradb/oradata/spodt2/temp
mkdir -p /u02/app/oradb/oradata/spodt2/redoa
mkdir -p /u03/app/oradb/oradata/spodt2/control1
mkdir -p /u03/app/oradb/oradata/spodt2/control2
mkdir -p /u01/app/oradb/archlogs/arch01/spodt2
mkdir -p /u01/app/oradb/archlogs/arch02/spodt2
3. Внесем изменения в фалйы: listener.ora и tnsnames.ora
$ more /u01/app/11.2.0.2/grid/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/11.2.0.2/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = spodt1.oracle.sun.com)
(ORACLE_HOME = /u01/app/oradb/product/11.2.0.2/dbhome_1)
(SID_NAME = spodt1)
)
(SID_DESC =
(GLOBAL_DBNAME = spodt2.oracle.sun.com)
(ORACLE_HOME = /u01/app/oradb/product/11.2.0.2/dbhome_1)
(SID_NAME = spodt2)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = kr400.oracle.sun.com)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oragrid
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
$
$ more /u01/app/oradb/product/11.2.0.2/dbhome_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oradb/product/11.2.0.2/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
SPOD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = kr400.oracle.sun.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = spod.oracle.sun.com)
)
)
SPODT1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = kr400.oracle.sun.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = spodt1.oracle.sun.com)
)
)
SPODT2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = kr400.oracle.sun.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = spodt2.oracle.sun.com)
)
)
4. Подготовим скрипт backupSPOD_tape.sh для создания резервной копии промышленной СУБД (SPOD)
$ more backupSPOD_tape.sh
ORACLE_HOME=/u01/app/oradb/product/11.2.0.2/dbhome_1
export ORACLE_HOME
ORACLE_SID=spod
export ORACLE_SID
rman target / catalog 'rman/passwd@catdb' << EOF
########################################## Clear configuration ###########################################
CONFIGURE RETENTION POLICY CLEAR;
CONFIGURE BACKUP OPTIMIZATION CLEAR;
CONFIGURE DEFAULT DEVICE TYPE CLEAR;
CONFIGURE CONTROLFILE AUTOBACKUP CLEAR;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT CLEAR;
CONFIGURE DEVICE TYPE DISK CLEAR;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK CLEAR;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT CLEAR;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK CLEAR;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT CLEAR;
CONFIGURE CHANNEL DEVICE TYPE DISK CLEAR;
CONFIGURE CHANNEL DEVICE TYPE SBT CLEAR;
CONFIGURE MAXSETSIZE CLEAR;
CONFIGURE SNAPSHOT CONTROLFILE NAME CLEAR;
########################################### Configure #####################################################
CONFIGURE DEFAULT DEVICE TYPE TO sbt;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F';
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' TO 1;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' TO 1;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/snapcf_orcl.f';
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
########################################### BACKUP SCRIPT #################################################
DELETE NOPROMPT obsolete redundancy 2;
CROSSCHECK BACKUP;
CROSSCHECK archivelog all;
CROSSCHECK COPY;
CROSSCHECK backup of database;
CROSSCHECK backup of controlfile;
RUN {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
SEND 'NB_ORA_SERV=nbsrv-1,NB_ORA_CLIENT=kr400-1,NB_ORA_POLICY=KR400_Oracle';
sql 'alter system switch logfile';
sql 'alter system archive log current';
backup database plus archivelog delete input;
sql 'alter system switch logfile';
sql 'alter system archive log current';
delete noprompt obsolete;
RELEASE CHANNEL ch00;
}
EOF
exit 0
$
5. Выполним резервное копирование промышленной СУБД (SPOD):
$ ./backupSPOD_tape.sh
Recovery Manager: Release 11.2.0.2.0 - Production on Thu Sep 8 16:04:28 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: SPOD (DBID=1675227431)
connected to recovery catalog database
RMAN>
RMAN> 2>
starting full resync of recovery catalog
full resync complete
old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 3 DAYS;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters:
CONFIGURE BACKUP OPTIMIZATION OFF;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u03/app/oradb/backups/rman/spod/cf_%F';
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
RMAN configuration parameters are successfully reset to default value
RMAN>
old RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
RMAN configuration parameters are successfully reset to default value
RMAN>
old RMAN configuration parameters:
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
RMAN configuration parameters are successfully reset to default value
RMAN>
old RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u03/app/oradb/backups/rman/spod/%U';
old RMAN configuration parameters are successfully deleted
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters are successfully deleted
RMAN>
old RMAN configuration parameters:
CONFIGURE MAXSETSIZE TO UNLIMITED;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u03/app/oradb/backups/rman/spod/snapcf_syslog.f';
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN> 2> 3>
new RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO '%F';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters:
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
new RMAN configuration parameters:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' TO 1;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
new RMAN configuration parameters:
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' TO 1;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
new RMAN configuration parameters:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/snapcf_orcl.f';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
RMAN> 2> 3>
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=100 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Veritas NetBackup for Oracle - Release 6.5 (2010042404)
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=131 device type=DISK
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 240920 08-SEP-11
Backup Piece 240932 08-SEP-11 8jmm1de7_1_1
Backup Set 240944 08-SEP-11
Backup Piece 240949 08-SEP-11 8kmm1dgv_1_1
Backup Set 240958 08-SEP-11
Backup Piece 240960 08-SEP-11 c-1675227431-20110908-06
Backup Set 241065 08-SEP-11
Backup Piece 241070 08-SEP-11 8mmm1mrk_1_1
Backup Set 241066 08-SEP-11
Backup Piece 241071 08-SEP-11 8omm1mv8_1_1
Backup Set 241067 08-SEP-11
Backup Piece 241072 08-SEP-11 8nmm1mrk_1_1
deleted backup piece
backup piece handle=8jmm1de7_1_1 RECID=207 STAMP=761312711
deleted backup piece
backup piece handle=8kmm1dgv_1_1 RECID=208 STAMP=761312799
deleted backup piece
backup piece handle=c-1675227431-20110908-06 RECID=209 STAMP=761312856
deleted backup piece
backup piece handle=8mmm1mrk_1_1 RECID=210 STAMP=761322356
deleted backup piece
backup piece handle=8omm1mv8_1_1 RECID=211 STAMP=761322472
deleted backup piece
backup piece handle=8nmm1mrk_1_1 RECID=212 STAMP=761322356
Deleted 6 objects
RMAN>
using channel ORA_SBT_TAPE_1
using channel ORA_DISK_1
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=8qmm1n29_1_1 RECID=213 STAMP=761322570
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=8pmm1n29_1_1 RECID=214 STAMP=761322570
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=8rmm1n4o_1_1 RECID=215 STAMP=761322648
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=c-1675227431-20110908-07 RECID=216 STAMP=761322705
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u03/app/oradb/backups/rman/spod/8tmm1s7i_1_1 RECID=217 STAMP=761327858
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u03/app/oradb/backups/rman/spod/8umm1s7j_1_1 RECID=218 STAMP=761327860
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u03/app/oradb/backups/rman/spod/8vmm1s8n_1_1 RECID=219 STAMP=761327895
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u03/app/oradb/backups/rman/spod/cf_c-1675227431-20110908-08 RECID=220 STAMP=761327897
Crosschecked 8 objects
RMAN>
released channel: ORA_SBT_TAPE_1
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=100 device type=DISK
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_409_760029095.dbf RECID=639 STAMP=761322763
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_410_760029095.dbf RECID=641 STAMP=761322765
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_411_760029095.dbf RECID=643 STAMP=761327856
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_412_760029095.dbf RECID=646 STAMP=761327856
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_413_760029095.dbf RECID=648 STAMP=761327857
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_414_760029095.dbf RECID=650 STAMP=761327895
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_415_760029095.dbf RECID=651 STAMP=761327900
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_415_760029095.dbf RECID=652 STAMP=761327900
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_416_760029095.dbf RECID=653 STAMP=761327902
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_416_760029095.dbf RECID=654 STAMP=761327902
Crosschecked 10 objects
RMAN>
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=100 device type=DISK
specification does not match any datafile copy in the repository
specification does not match any control file copy in the repository
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_409_760029095.dbf RECID=639 STAMP=761322763
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_410_760029095.dbf RECID=641 STAMP=761322765
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_411_760029095.dbf RECID=643 STAMP=761327856
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_412_760029095.dbf RECID=646 STAMP=761327856
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_413_760029095.dbf RECID=648 STAMP=761327857
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_414_760029095.dbf RECID=650 STAMP=761327895
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_415_760029095.dbf RECID=651 STAMP=761327900
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_415_760029095.dbf RECID=652 STAMP=761327900
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_416_760029095.dbf RECID=653 STAMP=761327902
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_416_760029095.dbf RECID=654 STAMP=761327902
Crosschecked 10 objects
RMAN>
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=131 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Veritas NetBackup for Oracle - Release 6.5 (2010042404)
using channel ORA_DISK_1
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u03/app/oradb/backups/rman/spod/8umm1s7j_1_1 RECID=218 STAMP=761327860
Crosschecked 1 objects
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=8qmm1n29_1_1 RECID=213 STAMP=761322570
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=8pmm1n29_1_1 RECID=214 STAMP=761322570
Crosschecked 2 objects
RMAN>
using channel ORA_SBT_TAPE_1
using channel ORA_DISK_1
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u03/app/oradb/backups/rman/spod/cf_c-1675227431-20110908-08 RECID=220 STAMP=761327897
Crosschecked 1 objects
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=c-1675227431-20110908-07 RECID=216 STAMP=761322705
Crosschecked 1 objects
RMAN>
RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13>
released channel: ORA_SBT_TAPE_1
released channel: ORA_DISK_1
allocated channel: ch00
channel ch00: SID=100 device type=SBT_TAPE
channel ch00: Veritas NetBackup for Oracle - Release 6.5 (2010042404)
sent command to channel: ch00
sql statement: alter system switch logfile
sql statement: alter system archive log current
Starting backup at 08-SEP-11
current log archived
channel ch00: starting archived log backup set
channel ch00: specifying archived log(s) in backup set
input archived log thread=1 sequence=409 RECID=639 STAMP=761322763
input archived log thread=1 sequence=410 RECID=641 STAMP=761322765
input archived log thread=1 sequence=411 RECID=643 STAMP=761327856
input archived log thread=1 sequence=412 RECID=646 STAMP=761327856
input archived log thread=1 sequence=413 RECID=648 STAMP=761327857
input archived log thread=1 sequence=414 RECID=650 STAMP=761327895
input archived log thread=1 sequence=415 RECID=651 STAMP=761327900
input archived log thread=1 sequence=416 RECID=653 STAMP=761327902
input archived log thread=1 sequence=417 RECID=655 STAMP=761328334
input archived log thread=1 sequence=418 RECID=657 STAMP=761328335
input archived log thread=1 sequence=419 RECID=660 STAMP=761328339
channel ch00: starting piece 1 at 08-SEP-11
channel ch00: finished piece 1 at 08-SEP-11
piece handle=91mm1sml_1_1 tag=TAG20110908T160540 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch00: backup set complete, elapsed time: 00:02:55
channel ch00: deleting archived log(s)
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_409_760029095.dbf RECID=639 STAMP=761322763
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_410_760029095.dbf RECID=641 STAMP=761322765
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_411_760029095.dbf RECID=643 STAMP=761327856
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_412_760029095.dbf RECID=646 STAMP=761327856
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_413_760029095.dbf RECID=648 STAMP=761327857
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_414_760029095.dbf RECID=650 STAMP=761327895
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_415_760029095.dbf RECID=651 STAMP=761327900
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_416_760029095.dbf RECID=653 STAMP=761327902
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_417_760029095.dbf RECID=655 STAMP=761328334
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_418_760029095.dbf RECID=657 STAMP=761328335
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_419_760029095.dbf RECID=660 STAMP=761328339
Finished backup at 08-SEP-11
Starting backup at 08-SEP-11
channel ch00: starting full datafile backup set
channel ch00: specifying datafile(s) in backup set
input datafile file number=00001 name=/u03/app/oradb/oradata/spod/system/system01.dbf
input datafile file number=00003 name=/u03/app/oradb/oradata/spod/undotbs/undotbs01.dbf
input datafile file number=00002 name=/u03/app/oradb/oradata/spod/sysaux/sysaux01.dbf
input datafile file number=00004 name=/u03/app/oradb/oradata/spod/users/users01.dbf
channel ch00: starting piece 1 at 08-SEP-11
channel ch00: finished piece 1 at 08-SEP-11
piece handle=92mm1ss6_1_1 tag=TAG20110908T160837 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch00: backup set complete, elapsed time: 00:01:25
Finished backup at 08-SEP-11
Starting backup at 08-SEP-11
current log archived
channel ch00: starting archived log backup set
channel ch00: specifying archived log(s) in backup set
input archived log thread=1 sequence=420 RECID=662 STAMP=761328604
channel ch00: starting piece 1 at 08-SEP-11
channel ch00: finished piece 1 at 08-SEP-11
piece handle=93mm1suv_1_1 tag=TAG20110908T161005 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch00: backup set complete, elapsed time: 00:00:55
channel ch00: deleting archived log(s)
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_420_760029095.dbf RECID=662 STAMP=761328604
Finished backup at 08-SEP-11
Starting Control File and SPFILE Autobackup at 08-SEP-11
piece handle=c-1675227431-20110908-09 comment=API Version 2.0,MMS Version 5.0.0.0
Finished Control File and SPFILE Autobackup at 08-SEP-11
sql statement: alter system switch logfile
sql statement: alter system archive log current
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 241093 08-SEP-11
Backup Piece 241098 08-SEP-11 8qmm1n29_1_1
Backup Set 241094 08-SEP-11
Backup Piece 241099 08-SEP-11 8pmm1n29_1_1
Backup Set 241111 08-SEP-11
Backup Piece 241114 08-SEP-11 8rmm1n4o_1_1
Backup Set 241123 08-SEP-11
Backup Piece 241125 08-SEP-11 c-1675227431-20110908-07
Backup Set 241191 08-SEP-11
Backup Piece 241197 08-SEP-11 /u03/app/oradb/backups/rman/spod/8tmm1s7i_1_1
deleted backup piece
backup piece handle=/u03/app/oradb/backups/rman/spod/8tmm1s7i_1_1 RECID=217 STAMP=761327858
Deleted 1 objects
deleted backup piece
backup piece handle=8qmm1n29_1_1 RECID=213 STAMP=761322570
deleted backup piece
backup piece handle=8pmm1n29_1_1 RECID=214 STAMP=761322570
deleted backup piece
backup piece handle=8rmm1n4o_1_1 RECID=215 STAMP=761322648
deleted backup piece
backup piece handle=c-1675227431-20110908-07 RECID=216 STAMP=761322705
Deleted 4 objects
released channel: ch00
RMAN>
Recovery Manager complete.
$
6. Подготовим скрипт makeSPODT2.sh для создания тестовой СУБД (SPODT2)
$ more makeSPODT2_tape.sh
#!/bin/bash
# Create temporary password file, must have same password as primary
rm /u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/orapwspodt2
orapwd file=/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/orapwspodt2 password=oracle
# Create temporary parameter file
echo "db_name=spodt2" > /u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/initspodt2.ora
export ORACLE_SID=spodt2
export ORACLE_HOME=/u01/app/oradb/product/11.2.0.2/dbhome_1
# Start up the auxiliary instance nomount
sqlplus '/ as sysdba' << EOF
shutdown immediate;
STARTUP PFILE='/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/initspodt2.ora' NOMOUNT;
EOF
rman << EOF
connect catalog rman/passwd@catdb;
connect auxiliary sys/oracle@spodt2;
run {
ALLOCATE AUXILIARY CHANNEL c1 DEVICE TYPE 'SBT_TAPE';
SEND 'NB_ORA_SERV=nbsrv-1,NB_ORA_CLIENT=kr400-1,NB_ORA_POLICY=KR400_Oracle';
duplicate database 'spod' to 'spodt2'
spfile
SET CONTROL_FILES '/u03/app/oradb/oradata/spodt2/control1/control01.ctl','/u03/app/oradb/oradata/spodt2/control2/control02.ctl'
SET LOG_FILE_NAME_CONVERT '/u02/app/oradb/oradata/spod/','/u02/app/oradb/oradata/spodt2/'
SET DB_FILE_NAME_CONVERT '/u03/app/oradb/oradata/spod/','/u03/app/oradb/oradata/spodt2/'
;
}
EOF
exit 0
$
7. Выполним этот скрипт :
$ ./makeSPODT2_tape.sh
SQL*Plus: Release 11.2.0.2.0 Production on Thu Sep 8 16:23:58 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> ORACLE instance started.
Total System Global Area 217157632 bytes
Fixed Size 2225064 bytes
Variable Size 159386712 bytes
Database Buffers 50331648 bytes
Redo Buffers 5214208 bytes
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Recovery Manager: Release 11.2.0.2.0 - Production on Thu Sep 8 16:24:22 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
RMAN>
connected to recovery catalog database
RMAN>
connected to auxiliary database: SPODT2 (not mounted)
RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10>
allocated channel: c1
channel c1: SID=67 device type=SBT_TAPE
channel c1: Veritas NetBackup for Oracle - Release 6.5 (2010042404)
sent command to channel: c1
Starting Duplicate Db at 08-SEP-11
contents of Memory Script:
{
set until scn 2836104;
restore clone spfile to '/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/spfilespodt2.ora';
sql clone "alter system set spfile= ''/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/spfilespodt2.ora''";
}
executing Memory Script
executing command: SET until clause
Starting restore at 08-SEP-11
WARNING: A restore time was estimated based on the supplied UNTIL SCN
channel c1: starting datafile backup set restore
channel c1: restoring SPFILE
output file name=/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/spfilespodt2.ora
channel c1: reading from backup piece c-1675227431-20110908-09
channel c1: piece handle=c-1675227431-20110908-09 tag=TAG20110908T161103
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:02:35
Finished restore at 08-SEP-11
sql statement: alter system set spfile= ''/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/spfilespodt2.ora''
contents of Memory Script:
{
sql clone "alter system set db_name =
''SPODT2'' comment=
''duplicate'' scope=spfile";
sql clone "alter system set CONTROL_FILES =
''/u03/app/oradb/oradata/spodt2/control1/control01.ctl'', ''/u03/app/oradb/oradata/spodt2/control2/control02.ctl'' comment=
'''' scope=spfile";
sql clone "alter system set LOG_FILE_NAME_CONVERT =
''/u02/app/oradb/oradata/spod/'', ''/u02/app/oradb/oradata/spodt2/'' comment=
'''' scope=spfile";
sql clone "alter system set db_file_name_convert =
''/u03/app/oradb/oradata/spod/'', ''/u03/app/oradb/oradata/spodt2/'' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set db_name = ''SPODT2'' comment= ''duplicate'' scope=spfile
sql statement: alter system set CONTROL_FILES = ''/u03/app/oradb/oradata/spodt2/control1/control01.ctl'', ''/u03/app/oradb/oradata/s podt2/control2/control02.ctl'' comment= '''' scope=spfile
sql statement: alter system set LOG_FILE_NAME_CONVERT = ''/u02/app/oradb/oradata/spod/'', ''/u02/app/oradb/oradata/spodt2/'' comment = '''' scope=spfile
sql statement: alter system set db_file_name_convert = ''/u03/app/oradb/oradata/spod/'', ''/u03/app/oradb/oradata/spodt2/'' comment= '''' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 217157632 bytes
Fixed Size 2225064 bytes
Variable Size 159386712 bytes
Database Buffers 50331648 bytes
Redo Buffers 5214208 bytes
allocated channel: c1
channel c1: SID=156 device type=SBT_TAPE
channel c1: Veritas NetBackup for Oracle - Release 6.5 (2010042404)
contents of Memory Script:
{
sql clone "alter system set db_name =
''SPOD'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''SPODT2'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''SPOD'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''SPODT2'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 217157632 bytes
Fixed Size 2225064 bytes
Variable Size 159386712 bytes
Database Buffers 50331648 bytes
Redo Buffers 5214208 bytes
allocated channel: c1
channel c1: SID=156 device type=SBT_TAPE
channel c1: Veritas NetBackup for Oracle - Release 6.5 (2010042404)
Starting restore at 08-SEP-11
channel c1: starting datafile backup set restore
channel c1: restoring control file
channel c1: reading from backup piece c-1675227431-20110908-09
channel c1: piece handle=c-1675227431-20110908-09 tag=TAG20110908T161103
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:45
output file name=/u03/app/oradb/oradata/spodt2/control1/control01.ctl
output file name=/u03/app/oradb/oradata/spodt2/control2/control02.ctl
Finished restore at 08-SEP-11
database mounted
contents of Memory Script:
{
set until scn 2836104;
set newname for datafile 1 to
"/u03/app/oradb/oradata/spodt2/system/system01.dbf";
set newname for datafile 2 to
"/u03/app/oradb/oradata/spodt2/sysaux/sysaux01.dbf";
set newname for datafile 3 to
"/u03/app/oradb/oradata/spodt2/undotbs/undotbs01.dbf";
set newname for datafile 4 to
"/u03/app/oradb/oradata/spodt2/users/users01.dbf";
restore
clone database
;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 08-SEP-11
channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00001 to /u03/app/oradb/oradata/spodt2/system/system01.dbf
channel c1: restoring datafile 00002 to /u03/app/oradb/oradata/spodt2/sysaux/sysaux01.dbf
channel c1: restoring datafile 00003 to /u03/app/oradb/oradata/spodt2/undotbs/undotbs01.dbf
channel c1: restoring datafile 00004 to /u03/app/oradb/oradata/spodt2/users/users01.dbf
channel c1: reading from backup piece 92mm1ss6_1_1
channel c1: piece handle=92mm1ss6_1_1 tag=TAG20110908T160837
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:01:35
Finished restore at 08-SEP-11
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=62 STAMP=761329812 file name=/u03/app/oradb/oradata/spodt2/system/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=63 STAMP=761329812 file name=/u03/app/oradb/oradata/spodt2/sysaux/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=64 STAMP=761329812 file name=/u03/app/oradb/oradata/spodt2/undotbs/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=65 STAMP=761329812 file name=/u03/app/oradb/oradata/spodt2/users/users01.dbf
contents of Memory Script:
{
set until scn 2836104;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 08-SEP-11
starting media recovery
archived log for thread 1 with sequence 420 is already on disk as file /u01/app/oradb/archlogs/arch01/spod/1_420_760029095.dbf
archived log for thread 1 with sequence 421 is already on disk as file /u01/app/oradb/archlogs/arch01/spod/1_421_760029095.dbf
archived log for thread 1 with sequence 422 is already on disk as file /u01/app/oradb/archlogs/arch01/spod/1_422_760029095.dbf
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_420_760029095.dbf thread=1 sequence=420
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_421_760029095.dbf thread=1 sequence=421
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_422_760029095.dbf thread=1 sequence=422
media recovery complete, elapsed time: 00:00:00
Finished recover at 08-SEP-11
Oracle instance started
Total System Global Area 217157632 bytes
Fixed Size 2225064 bytes
Variable Size 159386712 bytes
Database Buffers 50331648 bytes
Redo Buffers 5214208 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''SPODT2'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set db_name = ''SPODT2'' comment= ''Reset to original value by RMAN'' scope=spfile
sql statement: alter system reset db_unique_name scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 217157632 bytes
Fixed Size 2225064 bytes
Variable Size 159386712 bytes
Database Buffers 50331648 bytes
Redo Buffers 5214208 bytes
allocated channel: c1
channel c1: SID=156 device type=SBT_TAPE
channel c1: Veritas NetBackup for Oracle - Release 6.5 (2010042404)
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "SPODT2" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/u02/app/oradb/oradata/spodt2/redoa/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/u02/app/oradb/oradata/spodt2/redoa/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/u02/app/oradb/oradata/spodt2/redoa/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/u03/app/oradb/oradata/spodt2/system/system01.dbf'
CHARACTER SET CL8MSWIN1251
contents of Memory Script:
{
set newname for tempfile 1 to
"/u03/app/oradb/oradata/spodt2/temp/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/u03/app/oradb/oradata/spodt2/sysaux/sysaux01.dbf",
"/u03/app/oradb/oradata/spodt2/undotbs/undotbs01.dbf",
"/u03/app/oradb/oradata/spodt2/users/users01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u03/app/oradb/oradata/spodt2/temp/temp01.dbf in control file
cataloged datafile copy
datafile copy file name=/u03/app/oradb/oradata/spodt2/sysaux/sysaux01.dbf RECID=1 STAMP=761329853
cataloged datafile copy
datafile copy file name=/u03/app/oradb/oradata/spodt2/undotbs/undotbs01.dbf RECID=2 STAMP=761329853
cataloged datafile copy
datafile copy file name=/u03/app/oradb/oradata/spodt2/users/users01.dbf RECID=3 STAMP=761329853
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=761329853 file name=/u03/app/oradb/oradata/spodt2/sysaux/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=761329853 file name=/u03/app/oradb/oradata/spodt2/undotbs/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=761329853 file name=/u03/app/oradb/oradata/spodt2/users/users01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 08-SEP-11
released channel: c1
RMAN>
RMAN>
Recovery Manager complete.
$
8. Проверяем созданную базу данных (SPODT2)
$ ps -ef|grep pmon
oradb 8900 1 0 12:43 ? 00:00:01 ora_pmon_spod
oragrid 9167 1 0 12:43 ? 00:00:01 asm_pmon_+ASM
oradb 20306 1 0 14:25 ? 00:00:00 ora_pmon_spodt2
oradb 27736 1 0 Sep01 ? 00:00:14 ora_pmon_spodt1
$ export ORACLE_SID=spodt2
$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.2.0 Production on Thu Sep 1 12:32:10 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u03/app/oradb/oradata/spodt2/system/system01.dbf
/u03/app/oradb/oradata/spodt2/sysaux/sysaux01.dbf
/u03/app/oradb/oradata/spodt2/undotbs/undotbs01.dbf
/u03/app/oradb/oradata/spodt2/users/users01.dbf
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
/u03/app/oradb/oradata/spodt2/temp/temp01.dbf
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u02/app/oradb/oradata/spodt2/redoa/redo03.log
/u02/app/oradb/oradata/spodt2/redoa/redo02.log
/u02/app/oradb/oradata/spodt2/redoa/redo01.log
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/u03/app/oradb/oradata/spodt2/control1/control01.ctl
/u03/app/oradb/oradata/spodt2/control2/control02.ctl
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
$
$ export ORACLE_SID=spod
$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.2.0 Production on Thu Sep 1 11:34:02 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u03/app/oradb/oradata/spod/system/system01.dbf
/u03/app/oradb/oradata/spod/sysaux/sysaux01.dbf
/u03/app/oradb/oradata/spod/undotbs/undotbs01.dbf
/u03/app/oradb/oradata/spod/users/users01.dbf
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
/u03/app/oradb/oradata/spod/temp/temp01.dbf
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u02/app/oradb/oradata/spod/redoa/redo01.log
/u02/app/oradb/oradata/spod/redoa/redo02.log
/u02/app/oradb/oradata/spod/redoa/redo03.log
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/u03/app/oradb/oradata/spod/control1/control01.ctl
/u03/app/oradb/oradata/spod/control2/control02.ctl
SQL> exit
$ strings spfilespod.ora
spod.__db_cache_size=1409286144
spod.__java_pool_size=16777216
spod.__large_pool_size=16777216
spod.__oracle_base='/u01/app'#ORACLE_BASE set from environment
spod.__pga_aggregate_target=1342177280
spod.__sga_target=2013265920
spod.__shared_io_pool_size=0
spod.__shared_pool_size=520093696
spod.__streams_pool_size=16777216
*.audit_file_dest='/u01/app/admin/spod/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u03/app/oradb/oradata/spod/control1/control01.ctl','/u03/app/oradb/oradata/spod/control2/control02.ctl'
*.db_block_size=8192
*.db_domain='oracle.sun.com'
*.db_name='spod'
*.db_recovery_file_dest='/u01/app/fast_recovery_area'
*.db_recovery_file_dest_size=5218762752
*.diagnostic_dest='/u01/app'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=spodXDB)'
*.log_archive_dest_1='LOCATION=/u01/app/oradb/archlogs/arch01/spod/'
*.log_archive_dest_2='LOCATION=/u01/app/oradb/archlogs/arch02/spod OPTIONAL'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
$
2. Создаем структуру каталогов для тестовой базы данных (SPODT2)
mkdir -p /u03/app/oradb/oradata/spodt2/system
mkdir -p /u03/app/oradb/oradata/spodt2/sysaux
mkdir -p /u03/app/oradb/oradata/spodt2/undotbs
mkdir -p /u03/app/oradb/oradata/spodt2/users
mkdir -p /u03/app/oradb/oradata/spodt2/temp
mkdir -p /u02/app/oradb/oradata/spodt2/redoa
mkdir -p /u03/app/oradb/oradata/spodt2/control1
mkdir -p /u03/app/oradb/oradata/spodt2/control2
mkdir -p /u01/app/oradb/archlogs/arch01/spodt2
mkdir -p /u01/app/oradb/archlogs/arch02/spodt2
3. Внесем изменения в фалйы: listener.ora и tnsnames.ora
$ more /u01/app/11.2.0.2/grid/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/11.2.0.2/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = spodt1.oracle.sun.com)
(ORACLE_HOME = /u01/app/oradb/product/11.2.0.2/dbhome_1)
(SID_NAME = spodt1)
)
(SID_DESC =
(GLOBAL_DBNAME = spodt2.oracle.sun.com)
(ORACLE_HOME = /u01/app/oradb/product/11.2.0.2/dbhome_1)
(SID_NAME = spodt2)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = kr400.oracle.sun.com)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oragrid
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
$
$ more /u01/app/oradb/product/11.2.0.2/dbhome_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oradb/product/11.2.0.2/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
SPOD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = kr400.oracle.sun.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = spod.oracle.sun.com)
)
)
SPODT1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = kr400.oracle.sun.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = spodt1.oracle.sun.com)
)
)
SPODT2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = kr400.oracle.sun.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = spodt2.oracle.sun.com)
)
)
4. Подготовим скрипт backupSPOD_tape.sh для создания резервной копии промышленной СУБД (SPOD)
$ more backupSPOD_tape.sh
ORACLE_HOME=/u01/app/oradb/product/11.2.0.2/dbhome_1
export ORACLE_HOME
ORACLE_SID=spod
export ORACLE_SID
rman target / catalog 'rman/passwd@catdb' << EOF
########################################## Clear configuration ###########################################
CONFIGURE RETENTION POLICY CLEAR;
CONFIGURE BACKUP OPTIMIZATION CLEAR;
CONFIGURE DEFAULT DEVICE TYPE CLEAR;
CONFIGURE CONTROLFILE AUTOBACKUP CLEAR;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT CLEAR;
CONFIGURE DEVICE TYPE DISK CLEAR;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK CLEAR;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT CLEAR;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK CLEAR;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT CLEAR;
CONFIGURE CHANNEL DEVICE TYPE DISK CLEAR;
CONFIGURE CHANNEL DEVICE TYPE SBT CLEAR;
CONFIGURE MAXSETSIZE CLEAR;
CONFIGURE SNAPSHOT CONTROLFILE NAME CLEAR;
########################################### Configure #####################################################
CONFIGURE DEFAULT DEVICE TYPE TO sbt;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F';
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' TO 1;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' TO 1;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/snapcf_orcl.f';
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
########################################### BACKUP SCRIPT #################################################
DELETE NOPROMPT obsolete redundancy 2;
CROSSCHECK BACKUP;
CROSSCHECK archivelog all;
CROSSCHECK COPY;
CROSSCHECK backup of database;
CROSSCHECK backup of controlfile;
RUN {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
SEND 'NB_ORA_SERV=nbsrv-1,NB_ORA_CLIENT=kr400-1,NB_ORA_POLICY=KR400_Oracle';
sql 'alter system switch logfile';
sql 'alter system archive log current';
backup database plus archivelog delete input;
sql 'alter system switch logfile';
sql 'alter system archive log current';
delete noprompt obsolete;
RELEASE CHANNEL ch00;
}
EOF
exit 0
$
5. Выполним резервное копирование промышленной СУБД (SPOD):
$ ./backupSPOD_tape.sh
Recovery Manager: Release 11.2.0.2.0 - Production on Thu Sep 8 16:04:28 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: SPOD (DBID=1675227431)
connected to recovery catalog database
RMAN>
RMAN> 2>
starting full resync of recovery catalog
full resync complete
old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 3 DAYS;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters:
CONFIGURE BACKUP OPTIMIZATION OFF;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u03/app/oradb/backups/rman/spod/cf_%F';
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
RMAN configuration parameters are successfully reset to default value
RMAN>
old RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
RMAN configuration parameters are successfully reset to default value
RMAN>
old RMAN configuration parameters:
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
RMAN configuration parameters are successfully reset to default value
RMAN>
old RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u03/app/oradb/backups/rman/spod/%U';
old RMAN configuration parameters are successfully deleted
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters are successfully deleted
RMAN>
old RMAN configuration parameters:
CONFIGURE MAXSETSIZE TO UNLIMITED;
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u03/app/oradb/backups/rman/spod/snapcf_syslog.f';
RMAN configuration parameters are successfully reset to default value
starting full resync of recovery catalog
full resync complete
RMAN> 2> 3>
new RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO '%F';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
old RMAN configuration parameters:
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
new RMAN configuration parameters:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' TO 1;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
new RMAN configuration parameters:
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE 'SBT_TAPE' TO 1;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
new RMAN configuration parameters:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/snapcf_orcl.f';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN>
RMAN> 2> 3>
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=100 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Veritas NetBackup for Oracle - Release 6.5 (2010042404)
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=131 device type=DISK
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 240920 08-SEP-11
Backup Piece 240932 08-SEP-11 8jmm1de7_1_1
Backup Set 240944 08-SEP-11
Backup Piece 240949 08-SEP-11 8kmm1dgv_1_1
Backup Set 240958 08-SEP-11
Backup Piece 240960 08-SEP-11 c-1675227431-20110908-06
Backup Set 241065 08-SEP-11
Backup Piece 241070 08-SEP-11 8mmm1mrk_1_1
Backup Set 241066 08-SEP-11
Backup Piece 241071 08-SEP-11 8omm1mv8_1_1
Backup Set 241067 08-SEP-11
Backup Piece 241072 08-SEP-11 8nmm1mrk_1_1
deleted backup piece
backup piece handle=8jmm1de7_1_1 RECID=207 STAMP=761312711
deleted backup piece
backup piece handle=8kmm1dgv_1_1 RECID=208 STAMP=761312799
deleted backup piece
backup piece handle=c-1675227431-20110908-06 RECID=209 STAMP=761312856
deleted backup piece
backup piece handle=8mmm1mrk_1_1 RECID=210 STAMP=761322356
deleted backup piece
backup piece handle=8omm1mv8_1_1 RECID=211 STAMP=761322472
deleted backup piece
backup piece handle=8nmm1mrk_1_1 RECID=212 STAMP=761322356
Deleted 6 objects
RMAN>
using channel ORA_SBT_TAPE_1
using channel ORA_DISK_1
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=8qmm1n29_1_1 RECID=213 STAMP=761322570
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=8pmm1n29_1_1 RECID=214 STAMP=761322570
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=8rmm1n4o_1_1 RECID=215 STAMP=761322648
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=c-1675227431-20110908-07 RECID=216 STAMP=761322705
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u03/app/oradb/backups/rman/spod/8tmm1s7i_1_1 RECID=217 STAMP=761327858
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u03/app/oradb/backups/rman/spod/8umm1s7j_1_1 RECID=218 STAMP=761327860
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u03/app/oradb/backups/rman/spod/8vmm1s8n_1_1 RECID=219 STAMP=761327895
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u03/app/oradb/backups/rman/spod/cf_c-1675227431-20110908-08 RECID=220 STAMP=761327897
Crosschecked 8 objects
RMAN>
released channel: ORA_SBT_TAPE_1
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=100 device type=DISK
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_409_760029095.dbf RECID=639 STAMP=761322763
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_410_760029095.dbf RECID=641 STAMP=761322765
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_411_760029095.dbf RECID=643 STAMP=761327856
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_412_760029095.dbf RECID=646 STAMP=761327856
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_413_760029095.dbf RECID=648 STAMP=761327857
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_414_760029095.dbf RECID=650 STAMP=761327895
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_415_760029095.dbf RECID=651 STAMP=761327900
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_415_760029095.dbf RECID=652 STAMP=761327900
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_416_760029095.dbf RECID=653 STAMP=761327902
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_416_760029095.dbf RECID=654 STAMP=761327902
Crosschecked 10 objects
RMAN>
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=100 device type=DISK
specification does not match any datafile copy in the repository
specification does not match any control file copy in the repository
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_409_760029095.dbf RECID=639 STAMP=761322763
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_410_760029095.dbf RECID=641 STAMP=761322765
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_411_760029095.dbf RECID=643 STAMP=761327856
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_412_760029095.dbf RECID=646 STAMP=761327856
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_413_760029095.dbf RECID=648 STAMP=761327857
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_414_760029095.dbf RECID=650 STAMP=761327895
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_415_760029095.dbf RECID=651 STAMP=761327900
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_415_760029095.dbf RECID=652 STAMP=761327900
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_416_760029095.dbf RECID=653 STAMP=761327902
validation succeeded for archived log
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_416_760029095.dbf RECID=654 STAMP=761327902
Crosschecked 10 objects
RMAN>
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=131 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Veritas NetBackup for Oracle - Release 6.5 (2010042404)
using channel ORA_DISK_1
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u03/app/oradb/backups/rman/spod/8umm1s7j_1_1 RECID=218 STAMP=761327860
Crosschecked 1 objects
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=8qmm1n29_1_1 RECID=213 STAMP=761322570
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=8pmm1n29_1_1 RECID=214 STAMP=761322570
Crosschecked 2 objects
RMAN>
using channel ORA_SBT_TAPE_1
using channel ORA_DISK_1
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u03/app/oradb/backups/rman/spod/cf_c-1675227431-20110908-08 RECID=220 STAMP=761327897
Crosschecked 1 objects
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=c-1675227431-20110908-07 RECID=216 STAMP=761322705
Crosschecked 1 objects
RMAN>
RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13>
released channel: ORA_SBT_TAPE_1
released channel: ORA_DISK_1
allocated channel: ch00
channel ch00: SID=100 device type=SBT_TAPE
channel ch00: Veritas NetBackup for Oracle - Release 6.5 (2010042404)
sent command to channel: ch00
sql statement: alter system switch logfile
sql statement: alter system archive log current
Starting backup at 08-SEP-11
current log archived
channel ch00: starting archived log backup set
channel ch00: specifying archived log(s) in backup set
input archived log thread=1 sequence=409 RECID=639 STAMP=761322763
input archived log thread=1 sequence=410 RECID=641 STAMP=761322765
input archived log thread=1 sequence=411 RECID=643 STAMP=761327856
input archived log thread=1 sequence=412 RECID=646 STAMP=761327856
input archived log thread=1 sequence=413 RECID=648 STAMP=761327857
input archived log thread=1 sequence=414 RECID=650 STAMP=761327895
input archived log thread=1 sequence=415 RECID=651 STAMP=761327900
input archived log thread=1 sequence=416 RECID=653 STAMP=761327902
input archived log thread=1 sequence=417 RECID=655 STAMP=761328334
input archived log thread=1 sequence=418 RECID=657 STAMP=761328335
input archived log thread=1 sequence=419 RECID=660 STAMP=761328339
channel ch00: starting piece 1 at 08-SEP-11
channel ch00: finished piece 1 at 08-SEP-11
piece handle=91mm1sml_1_1 tag=TAG20110908T160540 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch00: backup set complete, elapsed time: 00:02:55
channel ch00: deleting archived log(s)
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_409_760029095.dbf RECID=639 STAMP=761322763
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_410_760029095.dbf RECID=641 STAMP=761322765
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_411_760029095.dbf RECID=643 STAMP=761327856
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_412_760029095.dbf RECID=646 STAMP=761327856
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_413_760029095.dbf RECID=648 STAMP=761327857
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_414_760029095.dbf RECID=650 STAMP=761327895
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_415_760029095.dbf RECID=651 STAMP=761327900
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_416_760029095.dbf RECID=653 STAMP=761327902
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_417_760029095.dbf RECID=655 STAMP=761328334
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_418_760029095.dbf RECID=657 STAMP=761328335
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_419_760029095.dbf RECID=660 STAMP=761328339
Finished backup at 08-SEP-11
Starting backup at 08-SEP-11
channel ch00: starting full datafile backup set
channel ch00: specifying datafile(s) in backup set
input datafile file number=00001 name=/u03/app/oradb/oradata/spod/system/system01.dbf
input datafile file number=00003 name=/u03/app/oradb/oradata/spod/undotbs/undotbs01.dbf
input datafile file number=00002 name=/u03/app/oradb/oradata/spod/sysaux/sysaux01.dbf
input datafile file number=00004 name=/u03/app/oradb/oradata/spod/users/users01.dbf
channel ch00: starting piece 1 at 08-SEP-11
channel ch00: finished piece 1 at 08-SEP-11
piece handle=92mm1ss6_1_1 tag=TAG20110908T160837 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch00: backup set complete, elapsed time: 00:01:25
Finished backup at 08-SEP-11
Starting backup at 08-SEP-11
current log archived
channel ch00: starting archived log backup set
channel ch00: specifying archived log(s) in backup set
input archived log thread=1 sequence=420 RECID=662 STAMP=761328604
channel ch00: starting piece 1 at 08-SEP-11
channel ch00: finished piece 1 at 08-SEP-11
piece handle=93mm1suv_1_1 tag=TAG20110908T161005 comment=API Version 2.0,MMS Version 5.0.0.0
channel ch00: backup set complete, elapsed time: 00:00:55
channel ch00: deleting archived log(s)
archived log file name=/u01/app/oradb/archlogs/arch02/spod/1_420_760029095.dbf RECID=662 STAMP=761328604
Finished backup at 08-SEP-11
Starting Control File and SPFILE Autobackup at 08-SEP-11
piece handle=c-1675227431-20110908-09 comment=API Version 2.0,MMS Version 5.0.0.0
Finished Control File and SPFILE Autobackup at 08-SEP-11
sql statement: alter system switch logfile
sql statement: alter system archive log current
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set 241093 08-SEP-11
Backup Piece 241098 08-SEP-11 8qmm1n29_1_1
Backup Set 241094 08-SEP-11
Backup Piece 241099 08-SEP-11 8pmm1n29_1_1
Backup Set 241111 08-SEP-11
Backup Piece 241114 08-SEP-11 8rmm1n4o_1_1
Backup Set 241123 08-SEP-11
Backup Piece 241125 08-SEP-11 c-1675227431-20110908-07
Backup Set 241191 08-SEP-11
Backup Piece 241197 08-SEP-11 /u03/app/oradb/backups/rman/spod/8tmm1s7i_1_1
deleted backup piece
backup piece handle=/u03/app/oradb/backups/rman/spod/8tmm1s7i_1_1 RECID=217 STAMP=761327858
Deleted 1 objects
deleted backup piece
backup piece handle=8qmm1n29_1_1 RECID=213 STAMP=761322570
deleted backup piece
backup piece handle=8pmm1n29_1_1 RECID=214 STAMP=761322570
deleted backup piece
backup piece handle=8rmm1n4o_1_1 RECID=215 STAMP=761322648
deleted backup piece
backup piece handle=c-1675227431-20110908-07 RECID=216 STAMP=761322705
Deleted 4 objects
released channel: ch00
RMAN>
Recovery Manager complete.
$
6. Подготовим скрипт makeSPODT2.sh для создания тестовой СУБД (SPODT2)
$ more makeSPODT2_tape.sh
#!/bin/bash
# Create temporary password file, must have same password as primary
rm /u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/orapwspodt2
orapwd file=/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/orapwspodt2 password=oracle
# Create temporary parameter file
echo "db_name=spodt2" > /u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/initspodt2.ora
export ORACLE_SID=spodt2
export ORACLE_HOME=/u01/app/oradb/product/11.2.0.2/dbhome_1
# Start up the auxiliary instance nomount
sqlplus '/ as sysdba' << EOF
shutdown immediate;
STARTUP PFILE='/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/initspodt2.ora' NOMOUNT;
EOF
rman << EOF
connect catalog rman/passwd@catdb;
connect auxiliary sys/oracle@spodt2;
run {
ALLOCATE AUXILIARY CHANNEL c1 DEVICE TYPE 'SBT_TAPE';
SEND 'NB_ORA_SERV=nbsrv-1,NB_ORA_CLIENT=kr400-1,NB_ORA_POLICY=KR400_Oracle';
duplicate database 'spod' to 'spodt2'
spfile
SET CONTROL_FILES '/u03/app/oradb/oradata/spodt2/control1/control01.ctl','/u03/app/oradb/oradata/spodt2/control2/control02.ctl'
SET LOG_FILE_NAME_CONVERT '/u02/app/oradb/oradata/spod/','/u02/app/oradb/oradata/spodt2/'
SET DB_FILE_NAME_CONVERT '/u03/app/oradb/oradata/spod/','/u03/app/oradb/oradata/spodt2/'
;
}
EOF
exit 0
$
7. Выполним этот скрипт :
$ ./makeSPODT2_tape.sh
SQL*Plus: Release 11.2.0.2.0 Production on Thu Sep 8 16:23:58 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> ORACLE instance started.
Total System Global Area 217157632 bytes
Fixed Size 2225064 bytes
Variable Size 159386712 bytes
Database Buffers 50331648 bytes
Redo Buffers 5214208 bytes
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Recovery Manager: Release 11.2.0.2.0 - Production on Thu Sep 8 16:24:22 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
RMAN>
connected to recovery catalog database
RMAN>
connected to auxiliary database: SPODT2 (not mounted)
RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10>
allocated channel: c1
channel c1: SID=67 device type=SBT_TAPE
channel c1: Veritas NetBackup for Oracle - Release 6.5 (2010042404)
sent command to channel: c1
Starting Duplicate Db at 08-SEP-11
contents of Memory Script:
{
set until scn 2836104;
restore clone spfile to '/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/spfilespodt2.ora';
sql clone "alter system set spfile= ''/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/spfilespodt2.ora''";
}
executing Memory Script
executing command: SET until clause
Starting restore at 08-SEP-11
WARNING: A restore time was estimated based on the supplied UNTIL SCN
channel c1: starting datafile backup set restore
channel c1: restoring SPFILE
output file name=/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/spfilespodt2.ora
channel c1: reading from backup piece c-1675227431-20110908-09
channel c1: piece handle=c-1675227431-20110908-09 tag=TAG20110908T161103
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:02:35
Finished restore at 08-SEP-11
sql statement: alter system set spfile= ''/u01/app/oradb/product/11.2.0.2/dbhome_1/dbs/spfilespodt2.ora''
contents of Memory Script:
{
sql clone "alter system set db_name =
''SPODT2'' comment=
''duplicate'' scope=spfile";
sql clone "alter system set CONTROL_FILES =
''/u03/app/oradb/oradata/spodt2/control1/control01.ctl'', ''/u03/app/oradb/oradata/spodt2/control2/control02.ctl'' comment=
'''' scope=spfile";
sql clone "alter system set LOG_FILE_NAME_CONVERT =
''/u02/app/oradb/oradata/spod/'', ''/u02/app/oradb/oradata/spodt2/'' comment=
'''' scope=spfile";
sql clone "alter system set db_file_name_convert =
''/u03/app/oradb/oradata/spod/'', ''/u03/app/oradb/oradata/spodt2/'' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set db_name = ''SPODT2'' comment= ''duplicate'' scope=spfile
sql statement: alter system set CONTROL_FILES = ''/u03/app/oradb/oradata/spodt2/control1/control01.ctl'', ''/u03/app/oradb/oradata/s podt2/control2/control02.ctl'' comment= '''' scope=spfile
sql statement: alter system set LOG_FILE_NAME_CONVERT = ''/u02/app/oradb/oradata/spod/'', ''/u02/app/oradb/oradata/spodt2/'' comment = '''' scope=spfile
sql statement: alter system set db_file_name_convert = ''/u03/app/oradb/oradata/spod/'', ''/u03/app/oradb/oradata/spodt2/'' comment= '''' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 217157632 bytes
Fixed Size 2225064 bytes
Variable Size 159386712 bytes
Database Buffers 50331648 bytes
Redo Buffers 5214208 bytes
allocated channel: c1
channel c1: SID=156 device type=SBT_TAPE
channel c1: Veritas NetBackup for Oracle - Release 6.5 (2010042404)
contents of Memory Script:
{
sql clone "alter system set db_name =
''SPOD'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''SPODT2'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
alter clone database mount;
}
executing Memory Script
sql statement: alter system set db_name = ''SPOD'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''SPODT2'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 217157632 bytes
Fixed Size 2225064 bytes
Variable Size 159386712 bytes
Database Buffers 50331648 bytes
Redo Buffers 5214208 bytes
allocated channel: c1
channel c1: SID=156 device type=SBT_TAPE
channel c1: Veritas NetBackup for Oracle - Release 6.5 (2010042404)
Starting restore at 08-SEP-11
channel c1: starting datafile backup set restore
channel c1: restoring control file
channel c1: reading from backup piece c-1675227431-20110908-09
channel c1: piece handle=c-1675227431-20110908-09 tag=TAG20110908T161103
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:45
output file name=/u03/app/oradb/oradata/spodt2/control1/control01.ctl
output file name=/u03/app/oradb/oradata/spodt2/control2/control02.ctl
Finished restore at 08-SEP-11
database mounted
contents of Memory Script:
{
set until scn 2836104;
set newname for datafile 1 to
"/u03/app/oradb/oradata/spodt2/system/system01.dbf";
set newname for datafile 2 to
"/u03/app/oradb/oradata/spodt2/sysaux/sysaux01.dbf";
set newname for datafile 3 to
"/u03/app/oradb/oradata/spodt2/undotbs/undotbs01.dbf";
set newname for datafile 4 to
"/u03/app/oradb/oradata/spodt2/users/users01.dbf";
restore
clone database
;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 08-SEP-11
channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00001 to /u03/app/oradb/oradata/spodt2/system/system01.dbf
channel c1: restoring datafile 00002 to /u03/app/oradb/oradata/spodt2/sysaux/sysaux01.dbf
channel c1: restoring datafile 00003 to /u03/app/oradb/oradata/spodt2/undotbs/undotbs01.dbf
channel c1: restoring datafile 00004 to /u03/app/oradb/oradata/spodt2/users/users01.dbf
channel c1: reading from backup piece 92mm1ss6_1_1
channel c1: piece handle=92mm1ss6_1_1 tag=TAG20110908T160837
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:01:35
Finished restore at 08-SEP-11
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=62 STAMP=761329812 file name=/u03/app/oradb/oradata/spodt2/system/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=63 STAMP=761329812 file name=/u03/app/oradb/oradata/spodt2/sysaux/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=64 STAMP=761329812 file name=/u03/app/oradb/oradata/spodt2/undotbs/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=65 STAMP=761329812 file name=/u03/app/oradb/oradata/spodt2/users/users01.dbf
contents of Memory Script:
{
set until scn 2836104;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 08-SEP-11
starting media recovery
archived log for thread 1 with sequence 420 is already on disk as file /u01/app/oradb/archlogs/arch01/spod/1_420_760029095.dbf
archived log for thread 1 with sequence 421 is already on disk as file /u01/app/oradb/archlogs/arch01/spod/1_421_760029095.dbf
archived log for thread 1 with sequence 422 is already on disk as file /u01/app/oradb/archlogs/arch01/spod/1_422_760029095.dbf
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_420_760029095.dbf thread=1 sequence=420
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_421_760029095.dbf thread=1 sequence=421
archived log file name=/u01/app/oradb/archlogs/arch01/spod/1_422_760029095.dbf thread=1 sequence=422
media recovery complete, elapsed time: 00:00:00
Finished recover at 08-SEP-11
Oracle instance started
Total System Global Area 217157632 bytes
Fixed Size 2225064 bytes
Variable Size 159386712 bytes
Database Buffers 50331648 bytes
Redo Buffers 5214208 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''SPODT2'' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
sql statement: alter system set db_name = ''SPODT2'' comment= ''Reset to original value by RMAN'' scope=spfile
sql statement: alter system reset db_unique_name scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 217157632 bytes
Fixed Size 2225064 bytes
Variable Size 159386712 bytes
Database Buffers 50331648 bytes
Redo Buffers 5214208 bytes
allocated channel: c1
channel c1: SID=156 device type=SBT_TAPE
channel c1: Veritas NetBackup for Oracle - Release 6.5 (2010042404)
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "SPODT2" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/u02/app/oradb/oradata/spodt2/redoa/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/u02/app/oradb/oradata/spodt2/redoa/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/u02/app/oradb/oradata/spodt2/redoa/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/u03/app/oradb/oradata/spodt2/system/system01.dbf'
CHARACTER SET CL8MSWIN1251
contents of Memory Script:
{
set newname for tempfile 1 to
"/u03/app/oradb/oradata/spodt2/temp/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/u03/app/oradb/oradata/spodt2/sysaux/sysaux01.dbf",
"/u03/app/oradb/oradata/spodt2/undotbs/undotbs01.dbf",
"/u03/app/oradb/oradata/spodt2/users/users01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u03/app/oradb/oradata/spodt2/temp/temp01.dbf in control file
cataloged datafile copy
datafile copy file name=/u03/app/oradb/oradata/spodt2/sysaux/sysaux01.dbf RECID=1 STAMP=761329853
cataloged datafile copy
datafile copy file name=/u03/app/oradb/oradata/spodt2/undotbs/undotbs01.dbf RECID=2 STAMP=761329853
cataloged datafile copy
datafile copy file name=/u03/app/oradb/oradata/spodt2/users/users01.dbf RECID=3 STAMP=761329853
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=761329853 file name=/u03/app/oradb/oradata/spodt2/sysaux/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=761329853 file name=/u03/app/oradb/oradata/spodt2/undotbs/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=761329853 file name=/u03/app/oradb/oradata/spodt2/users/users01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 08-SEP-11
released channel: c1
RMAN>
RMAN>
Recovery Manager complete.
$
8. Проверяем созданную базу данных (SPODT2)
$ ps -ef|grep pmon
oradb 8900 1 0 12:43 ? 00:00:01 ora_pmon_spod
oragrid 9167 1 0 12:43 ? 00:00:01 asm_pmon_+ASM
oradb 20306 1 0 14:25 ? 00:00:00 ora_pmon_spodt2
oradb 27736 1 0 Sep01 ? 00:00:14 ora_pmon_spodt1
$ export ORACLE_SID=spodt2
$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.2.0 Production on Thu Sep 1 12:32:10 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u03/app/oradb/oradata/spodt2/system/system01.dbf
/u03/app/oradb/oradata/spodt2/sysaux/sysaux01.dbf
/u03/app/oradb/oradata/spodt2/undotbs/undotbs01.dbf
/u03/app/oradb/oradata/spodt2/users/users01.dbf
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
/u03/app/oradb/oradata/spodt2/temp/temp01.dbf
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u02/app/oradb/oradata/spodt2/redoa/redo03.log
/u02/app/oradb/oradata/spodt2/redoa/redo02.log
/u02/app/oradb/oradata/spodt2/redoa/redo01.log
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/u03/app/oradb/oradata/spodt2/control1/control01.ctl
/u03/app/oradb/oradata/spodt2/control2/control02.ctl
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
$
Комментариев нет:
Отправить комментарий