Вы находитесь на странице: 1из 7

Step-by-Step Instructions for Creating Standby Database

Prerequisites Assume that The current database has sid=primary Take the cold backup of the primary database that includes datafiles,redo-log files, controlfiles,init<sid>.ora, pwd<sid>.ora Location of Datfiles,Redo log Files and Controlfiles C:\app\Administrator\oradata\<sid> Steps on Primary DB --------------------------C:\Documents and Settings\Administrator>set oracle_sid=sid of primary db C:\Documents and Settings\Administrator>sqlplus sys as sysdba SQL*Plus: Release 11.1.0.6.0 - Production on Sat Jan 29 15:30:40 2011 Copyright (c) 1982, 2007, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Preparing the Primary Database for Standby Database Creation. Step-1 Enable Forced Logging Place the primary database in FORCE LOGGING mode after database creation using the following SQL statement: SQL> ALTER DATABASE FORCE LOGGING; This statement can take a considerable amount of time to complete, because it waits for all unlogged direct write I/O to finish. Step-2 The following SQL statements will be used to create a standby redo log. ALTER DATABASE ADD STANDBY LOGFILE ('D:\app\Administrator\oradata\primary\slog1.rdo') SIZE 50M;

ALTER DATABASE ADD STANDBY LOGFILE ('D:\app\Administrator\oradata\primary\slog2.rdo') SIZE 50M; ALTER DATABASE ADD STANDBY LOGFILE ('D:\app\Administrator\oradata\primary\slog3.rdo') SIZE 50M; Step-3 Set Primary Database Initialization Parameters Add Extra lines in the blue colour to ur current init<sid>.ora which in this case would be initprimary.ora ('C:\app\Administrator\product\11.1.0\database\initprimary.ora') primary.__db_cache_size=738197504 primary.__java_pool_size=16777216 primary.__large_pool_size=8388608 primary.__oracle_base='C:\app\Administrator'#ORACLE_BASE set from environment primary.__pga_aggregate_target=645922816 primary.__sga_target=1073741824 primary.__shared_io_pool_size=0 primary.__shared_pool_size=301989888 primary.__streams_pool_size=0 *.audit_file_dest='C:\app\Administrator\admin\primary\adump' *.audit_trail='db' *.compatible='11.1.0.0.0' *.control_files='C:\app\Administrator\oradata\primary\control01.ctl','C:\app\Administrator\ oradata\primary\control02.ctl','C:\app\Administrator\oradata\primary\control03.ctl' *.db_block_size=8192 *.db_domain='' *.db_name='primary' *.db_recovery_file_dest='C:\app\Administrator\flash_recovery_area' *.db_recovery_file_dest_size=8589934592 *.diagnostic_dest='C:\app\Administrator' *.dispatchers='(PROTOCOL=TCP) (SERVICE=primaryXDB)' *.memory_target=1717567488 *.open_cursors=300 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.undo_tablespace='UNDOTBS1' *.LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=primary' *.LOG_ARCHIVE_DEST_2='SERVICE=standby ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=primary' *.LOG_ARCHIVE_DEST_STATE_1=ENABLE *.LOG_ARCHIVE_DEST_STATE_2=ENABLE *.REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE *.LOG_ARCHIVE_FORMAT=%t_%s_%r.arc *.LOG_ARCHIVE_MAX_PROCESSES=30

*.FAL_SERVER=standby *.FAL_CLIENT=primary *.STANDBY_FILE_MANAGEMENT=AUTO *.log_archive_Start=true *.DB_UNIQUE_NAME=primary Step-4 Enable Archiving if not enabled If archiving is not enabled, issue the following statements to put the primary database in ARCHIVELOG mode and enable automatic archiving: SQL> SELECT LOG_MODE FROM V$DATABASE; if it returns ARCHIVELOG..that means the database is already in archivelog mode.. else perform the below 3 commands SQL> SHUTDOWN IMMEDIATE; SQL> STARTUP MOUNT; SQL> ALTER DATABASE ARCHIVELOG; Step-5 Create a Control File for the Standby Database Now create the control file for the standby database as shown in the following example: SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS 'C:\APP\ADMINISTRATOR\ORADATA\DB2\STNDBY01.CTL'; SQL> SHUTDOWN IMMEDIATE; (Take Cold backup as below)

Step-by-Step Instructions for Creating a Physical Standby Database Step-1 please shut down database before taking backup of files.Take cold backup ie copy the required files of primary database that includes datafiles,redo-log files, standby controlfile,init<sid>.ora, pwd<sid>.ora and tnsnames.ora fiels Note:Donot copy controlfiles because the standby database will be up with standby controlfile which v have already copied.. Location of Datfiles,Redo log Files and Controlfiles C:\app\Administrator\oradata\<sid> Location of initprimary.ora and pwdprimary.ora ('C:\app\Administrator\product\11.1.0\database\initprimary.ora') ('C:\app\Administrator\product\11.1.0\database\pwdprimary.ora') Location of tnsnames.ora ('C:\app\Administrator\product\11.1.0\network\admin\tnsnames.ora')

Step-2 Once the files are copied to a seperate folder on the server..then startup the primary database.. SQL> STARTUP Steps on Standby DB --------------------------Step-3 Once the folder is copied on to the server where u want to create standby database.. 3.1 Create a folder with name of sid in C:\app\Administrator\oradata\<sid> (ie primary) 3.2 Also move the intora and pwdfiles to the location 'C:\app\Administrator\product\11.1.0\database' 3.3 Also move the tnsnames.ora file to the location 'C:\app\Administrator\product\11.1.0\network\admin' Step-4 Prepare an Initialization Parameter File for the Standby Database. Add Extra lines in the blue colour to ur current init<sid>.ora which in this case would be initprimary.ora ('C:\app\Administrator\product\11.1.0\database\initprimary.ora') primary.__db_cache_size=738197504 primary.__java_pool_size=16777216 primary.__large_pool_size=8388608 primary.__oracle_base='C:\app\Administrator'#ORACLE_BASE set from environment primary.__pga_aggregate_target=645922816 primary.__sga_target=1073741824 primary.__shared_io_pool_size=0 primary.__shared_pool_size=301989888 primary.__streams_pool_size=0 *.audit_file_dest='C:\app\Administrator\admin\primary\adump' *.audit_trail='db'

*.compatible='11.1.0.0.0' *.control_files='C:\APP\ADMINISTRATOR\ORADATA\PRIMARY\SBCONTROL0 1.CTL' *.db_block_size=8192 *.db_domain='' *.db_name='primary' *.db_recovery_file_dest='C:\app\Administrator\flash_recovery_area' *.db_recovery_file_dest_size=8589934592 *.diagnostic_dest='C:\app\Administrator' *.dispatchers='(PROTOCOL=TCP) (SERVICE=primaryXDB)' *.memory_target=1717567488 *.open_cursors=300 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.undo_tablespace='UNDOTBS1' *.LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=primary' *.LOG_ARCHIVE_DEST_2='SERVICE=primary ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=primary' *.LOG_ARCHIVE_DEST_STATE_1=ENABLE *.LOG_ARCHIVE_DEST_STATE_2=ENABLE *.REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE *.LOG_ARCHIVE_FORMAT=%t_%s_%r.arc *.LOG_ARCHIVE_MAX_PROCESSES=30

*.FAL_SERVER=primary *.FAL_CLIENT=standby *.STANDBY_FILE_MANAGEMENT=AUTO *.log_archive_Start=true *.DB_UNIQUE_NAME=primary Step-5 Create a Windows-based service. If the standby database will be hosted on a Windows system, use the ORADIM utility to create a Windows service. For example: oradim NEW SID primary STARTMODE manual Step-6 Start the Physical Standby Database Perform the following steps to start the physical standby database and Redo Apply. C:\Documents and Settings\Administrator>set oracle_sid=sid of standby db C:\Documents and Settings\Administrator>sqlplus sys as sysdba SQL*Plus: Release 11.1.0.6.0 - Production on Sat Jan 29 15:30:40 2011 Copyright (c) 1982, 2007, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options 6.1 On the standby database, issue the following SQL statement to start and mount the database: SQL> STARTUP MOUNT; 6.2 2 Start Redo Apply. On the standby database, issue the following command to start Redo Apply: SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

Standby Created successfully and DataGaurd is ON Step -7 To check if the Dataguard has been implemented successfully On Standby DB SQL> SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY; If you find MRP0 process that means DataGaurd is On and working.. ----------------------------------------------------------------------------------------------------------THE END -----------------------------------------------------------------------------------------------------------

Вам также может понравиться