First use DBCA to build a database, db_name=primary.
2. Prepare a static listener for two databases. and connecting each other's Tnsname
11gdg1-> cat listener.ora tnsnames.ora # listener.ora network configuration file: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora# generated by oracle configuration tools. sid_list_listener = (sid_list = (SID_DESC = (global_dbname = primary) (oracle_home = /u01/app/oracle/product/11.2.0/db_1) (sid_name = primary) ) (sid_desc = (Global_ Dbname = standby) (oracle_home = /u01/app/oracle/ product/11.2.0/db_1) (sid_name = standby) ) ) listener = (description = (ADDRESS = (PROTOCOL = TCP) (host = 11gdg1.localdomain.com) (port = 1521)) ) adr_base_listener = /u01/app/oracle# tnsnames.ora network configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora# generated by oracle configuration tools. primary = (description = (address_list = (address = (protocol = tcp) (host = 192.168.199.216) (PORT = 1521) ) (connect_data = (service_name = primary) ) ) standby = (description = (address_list = (ADDRESS = (PROTOCOL = TCP) (host = 192.168.199.216) (port = 1521)) ) (connect_data = (SERVICE_ Name = standby) ) 11gdg1-> )
3. To create a simple pfile from the library
11gdg1-> echo "Db_name=whatever" > Initstandby.ora
4. To create a password file from the library
11gdg1-> CP orapwprimary Orapwstandby
5. Create the directory you want from the library
11gdg1->mkdir-p/u01/app/oracle/admin/standby/adump11gdg1->mkdir-p/u01/app/oracle/oradata/standby 11gdg1- >mkdir-p/u01/app/oracle/fast_recovery_area/standby
6. Start from database to mount
7. Change the main library to force LOGGING
sql> ALTER DATABASE force Logging;database altered.
8. Open the main library archive
sql> archive log listdatabase log mode No Archive ModeAutomatic archival Disabledarchive destination use_db_recovery_file_ Destoldest online log sequence 1current log sequence 2sql> shutdown immediatedatabase closed. Database dismounted. Oracle instance shut down. Sql> startup mountoracle instance started. total system global area 839282688 bytesfixed size 2233000 bytesVariable Size 494931288 bytesDatabase buffers 339738624 bytesredo buffers 2379776 bytesDatabase Mounted. Sql> alter database archivelog;database altered. Sql> alter database open;database altered.
9. Create standby Log
ALTER DATABASE ADD STANDBY LOGFILE '/u01/app/oracle/oradata/primary/sredo01.log ' size 50M; ALTER DATABASE ADD STANDBY LOGFILE '/u01/app/oracle/oradata/primary/sredo02.log ' size 50M; ALTER DATABASE ADD STANDBY LOGFILE '/u01/app/oracle/oradata/primary/sredo03.log ' size 50M; ALTER DATABASE ADD STANDBY LOGFILE '/u01/app/oracle/oradata/primary/sredo04.log ' size 50M;
10. Create a standby database
Run { allocate channel prmy1 type disk; allocate channel prmy2 type disk; allocate channel prmy3 type disk; allocate channel prmy4 type disk; allocate channel prmy5 type disk; allocate auxiliary channel stby1 type disk; duplicate target database for standby from active database spfile parameter_value_convert ' primary ', ' Standby ' set ' db_unique_name ' = ' standby ' set control_files= '/u01/app/oracle/oradata/standby/ Control01.ctl ' set db_recovery_file_dest= '/u01/app/oracle/fast_recovery_area ' set DB_RECOVERY_FILE_ Dest_size= ' 4G ' set log_file_name_convert= '/primary/', '/standby/' set db_file_name_convert= '/primary/', '/standby/' set fal_server= ' primary ' set standby_file_management= ' AUTO ' set log_archive_config= ' DG _config= (primary,standby) ' Set log_archive_dest_2= ' service=primary lgwr async valid_for= (online_logfiles,primary_role) db_ Unique_name=primary ' nofilenamecheck;sql channel prmy1 ' Alter system set log_ Archive_config= ' dg_config= (primary,standby) ' ";sql channel prmy1 " Alter system set log_archive_dest_2= ' service=standby lgwr async valid_for= (ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=standby ' ";sql channel prmy1 " alter system set log_archive_ Max_processes=5 ";sql channel prmy1 " Alter system set fal_server=standby "; sql channel prmy1 "Alter system set standby_file_management=auto"; sql channel prmy1 "Alter system archive log current"; allocate auxiliary channel stby type disk;sql channel stby "alter database recover managed standby database using current logfile disconnect ";}
11. Verifying Data Synchronization
Main Library
sql> conn/as sysdbaconnected.sql> alter user Scott account unlock; User altered. Sql> alter user Scott identified by Tiger; User altered. Sql> conn scott/tigerconnected.sql> CREATE table T1 as select * from EMP; Table created.
From the Library
sql> ALTER DATABASE recover managed standby database Cancel;database altered. sql> ALTER DATABASE Open;database altered. Sql> Conn Scott/tigerconnected.sql> Select COUNT (*) from T1; COUNT (*)----------14
This article is from the "Ding Dong" blog, please be sure to keep this source http://lqding.blog.51cto.com/9123978/1682780
Oracle Learning Dataguard (10) creates a DG on the same machine using the new 11g Rman feature