Powered By Blogger

Monday, March 23, 2009

Standby Database Configuration in Oracle 10g

check this document from Oracle for Dataguard Configuration and standby database configuration.
*** http://www.oracle.com/technology/pub/articles/smiley-fsfo.html?msgid=7569547
check this link for Switchover from primary to standby :
*** http://www.orafaq.com/node/2078

1.Check primary database in archivelog mode.

2.Alter database force logging.

BACKUP DATABASE
3.RMAN> run
2> {
3> allocate channel c1 device type disk format='E:\bkp\db_%U';
4> backup database;
5> }

allocated channel: c1
channel c1: sid=131 devtype=DISK

Starting backup at 22-FEB-08
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00001 name=E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF
input datafile fno=00003 name=E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF
input datafile fno=00004 name=E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF
input datafile fno=00002 name=E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF
channel c1: starting piece 1 at 22-FEB-08
channel c1: finished piece 1 at 22-FEB-08
piece handle=E:\BKP\DB_8GJ9BGMF_1_1 tag=TAG20080222T110903 comment=NONE
channel c1: backup set complete, elapsed time: 00:02:34
Finished backup at 22-FEB-08

Starting Control File and SPFILE Autobackup at 22-FEB-08
piece handle=E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2008_02_22\O1_MF_S_647349097_3VWR4LQG_.BKP comment=NONE
Finished Control File and SPFILE Autobackup at 22-FEB-08
released channel: c1


4. BACKUP CURRENT CONTROLFILE FOR STANDBY

RMAN> run
2> {
3> allocate channel c1 device type disk format='E:\bkp\crtl\ctrl01.ctl';
4> shutdown immediate;
5> startup mount;
6> backup current controlfile for standby;
7> }

allocated channel: c1
channel c1: sid=131 devtype=DISK

database closed
database dismounted
Oracle instance shut down

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area 289406976 bytes

Fixed Size 1248576 bytes
Variable Size 113246912 bytes
Database Buffers 167772160 bytes
Redo Buffers 7139328 bytes

Starting backup at 22-FEB-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=154 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including standby control file in backupset
channel ORA_DISK_1: starting piece 1 at 22-FEB-08
channel ORA_DISK_1: finished piece 1 at 22-FEB-08
piece handle=E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2008_02_22\O1_MF_NCNNF_TAG20080222T111356_3VWR8YL2_.BKP tag
=TAG20080222T111356 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 22-FEB-08

Starting Control File and SPFILE Autobackup at 22-FEB-08
piece handle=E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\AUTOBACKUP\2008_02_22\O1_MF_S_647349215_3VWR914W_.BKP comment=NONE
Finished Control File and SPFILE Autobackup at 22-FEB-08

5. alter database open;

6. CREATED PASSWORD FILE FOR STANDBY DATABASE
>> orapwd file=E:\oracle\product\10.2.0\db_1\database\pwdstdby.ora password=adminkurnia entries=5 << db_unique_name="orcl" log_archive_config="'DG_CONFIG=" log_archive_dest_1="'location=" log_archive_dest_2 ="'SERVICE=" db_unique_name="stdby'" log_file_name_convert="'C:\stdby_db\file\REDO03.LOG','E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG','C:\stdby_db\file\REDO02.LOG','E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG','C:\stdby_db\file\REDO01.LOG','E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG'" log_archive_dest_state_1="ENABLE" log_archive_dest_state_2="ENABLE" fal_server="stdby" fal_client="orcl" standby_file_management="AUTO" pfile="'PRIMARY">> TO IMPLEMENT THE CHANGE IN SPFILE << pfile="'">> TO CREATE THE PFILE FOR STANDBY DATABASE << __db_cache_size="205520896" __java_pool_size="4194304" __large_pool_size="4194304" __shared_pool_size="67108864" __streams_pool_size="0" lock_name_space="'stdby'" audit_file_dest="'E:\oracle\product\10.2.0/admin/stdby/adump'" background_dump_dest="'E:\oracle\product\10.2.0/admin/stdby/bdump'" compatible="'10.2.0.1.0'" control_files="'C:\stdby_db\file\control01.ctl','C:\stdby_db\file\control02.ctl','C:\stdby_db\file\control03.ctl'" core_dump_dest="'E:\oracle\product\10.2.0/admin/stdby/cdump'" db_block_size="8192" db_domain="''" db_file_multiblock_read_count="16" db_name="'orcl'" instance_name="'stdby'" db_recovery_file_dest="'C:\stdby_db\flash_recovery_area'" db_recovery_file_dest_size="2147483648" db_unique_name="'stdby'" dispatchers="'(PROTOCOL=" service="orclXDB)'" fal_client="'stdby'" fal_server="'orcl'" job_queue_processes="10" log_archive_config="'DG_CONFIG=" log_archive_dest_1="'location=" log_archive_dest_2="'SERVICE=" db_unique_name="orcl'" log_archive_dest_state_1="'ENABLE'" log_archive_dest_state_2="'ENABLE'" log_file_name_convert="'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG','C:\stdby_db\file\REDO03.LOG','E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG','C:\stdby_db\file\REDO02.LOG','E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG','C:\stdby_db\file\REDO01.LOG'" open_cursors="300" pga_aggregate_target="95420416" processes="150" remote_login_passwordfile="'EXCLUSIVE'" sga_target="287309824" standby_file_management="'AUTO'" undo_management="'AUTO'" undo_tablespace="'UNDOTBS1'" user_dump_dest="'E:\oracle\product\10.2.0/admin/stdby/udump'">>oradim -new -sid stdby -pfile E:\oracle\product\10.2.0\admin\stdby\pfile\initstdby.ora -startmode a <<> run
2> {
3> allocate auxiliary channel c1 type disk;
4> set newname for datafile 1 to 'C:\stdby_db\file\SYSTEM01.DBF';
5> set newname for datafile 2 to 'C:\stdby_db\file\UNDOTBS01.DBF';
6> set newname for datafile 3 to 'C:\stdby_db\file\SYSAUX01.DBF';
7> set newname for datafile 4 to 'C:\stdby_db\file\USERS01.DBF';
8> set newname for tempfile 1 to 'C:\stdby_db\file\TEMP01.DBF';
9> duplicate target database for standby
10> ;
11> }

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: sid=157 devtype=DISK

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting Duplicate Db at 22-FEB-08

contents of Memory Script:
{
restore clone standby controlfile;
sql clone 'alter database mount standby database';
}
executing Memory Script

Starting restore at 22-FEB-08

channel c1: starting datafile backupset restore
channel c1: restoring control file
channel c1: reading from backup piece E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2008_02_22\O1_MF_NCNNF_TAG20080222
T111356_3VWR8YL2_.BKP
channel c1: restored backup piece 1
piece handle=E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2008_02_22\O1_MF_NCNNF_TAG20080222T111356_3VWR8YL2_.BKP tag
=TAG20080222T111356
channel c1: restore complete, elapsed time: 00:00:05
output filename=C:\STDBY_DB\FILE\CONTROL01.CTL
output filename=C:\STDBY_DB\FILE\CONTROL02.CTL
output filename=C:\STDBY_DB\FILE\CONTROL03.CTL
Finished restore at 22-FEB-08

sql statement: alter database mount standby database

contents of Memory Script:
{
set newname for tempfile 1 to
"C:\stdby_db\file\TEMP01.DBF";
switch clone tempfile all;
set newname for datafile 1 to
"C:\STDBY_DB\FILE\SYSTEM01.DBF";
set newname for datafile 2 to
"C:\STDBY_DB\FILE\UNDOTBS01.DBF";
set newname for datafile 3 to
"C:\STDBY_DB\FILE\SYSAUX01.DBF";
set newname for datafile 4 to
"C:\STDBY_DB\FILE\USERS01.DBF";
restore
check readonly
clone database
;
}
executing Memory Script

executing command: SET NEWNAME

renamed temporary file 1 to C:\stdby_db\file\TEMP01.DBF in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 22-FEB-08

channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to C:\STDBY_DB\FILE\SYSTEM01.DBF
restoring datafile 00002 to C:\STDBY_DB\FILE\UNDOTBS01.DBF
restoring datafile 00003 to C:\STDBY_DB\FILE\SYSAUX01.DBF
restoring datafile 00004 to C:\STDBY_DB\FILE\USERS01.DBF
channel c1: reading from backup piece E:\BKP\DB_8GJ9BGMF_1_1
channel c1: restored backup piece 1
piece handle=E:\BKP\DB_8GJ9BGMF_1_1 tag=TAG20080222T110903
channel c1: restore complete, elapsed time: 00:01:55
Finished restore at 22-FEB-08

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy recid=32 stamp=647364559 filename=C:\STDBY_DB\FILE\SYSTEM01.DBF
datafile 2 switched to datafile copy
input datafile copy recid=33 stamp=647364560 filename=C:\STDBY_DB\FILE\UNDOTBS01.DBF
datafile 3 switched to datafile copy
input datafile copy recid=34 stamp=647364560 filename=C:\STDBY_DB\FILE\SYSAUX01.DBF
datafile 4 switched to datafile copy
input datafile copy recid=35 stamp=647364560 filename=C:\STDBY_DB\FILE\USERS01.DBF
Finished Duplicate Db at 22-FEB-08
released channel: c1

RMAN>


13.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Database altered.

SQL> recover managed standby database cancel;
Media recovery complete.
SQL>

14.SQL> alter database open read only;

Database altered.
SQL> shutdown immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup standby database
SP2-0714: invalid combination of STARTUP options
SQL> startup mount
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.

Total System Global Area 289406976 bytes
Fixed Size 1248576 bytes
Variable Size 75498176 bytes
Database Buffers 205520896 bytes
Redo Buffers 7139328 bytes
Database mounted.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Database altered.

SQL> alter database open read only;
alter database open read only
*
ERROR at line 1:
ORA-01154: database busy. Open, close, mount, and dismount not allowed now


SQL> recover managed standby database cancel;
Media recovery complete.
SQL> alter database open read only;

Database altered.

SQL> select count(*) from navaneeth;

COUNT(*)
----------
13

Reference:

http://www.dbapool.com/articles/043005.html
http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/create_ps.htm#g88234
http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/rcmbackp.htm#i636427
http://www.orafaq.com/node/957

http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/log_apply.htm

No comments:

Post a Comment