oracle11g R2 "rac+asm→ Single Instance FS"

Source: Internet
Author: User

oracle11g R2 "rac+asm→ Single Instance FS"

Oneg R2 rac+asmà Single Instance FS DG, it is recommended to disable OMF.

Environment used in this demo case:

Primary

Standby

OS Hostname

Node1,node2

Std

OS Version

RHEL6.5

RHEL6.5

DB Version

11.2.0.4

11.2.0.4

Db_name

Stephen

Stephen

Db_unique_name

Stephen

Standby

Service_names

Stephen

Standby

Instance_name

Stephen1,stephen2

Standby

Primary database Configure1. Enable Primary Force logging

Sql> select force_logging from V$database;

sql> ALTER DATABASE force logging;

2. Configuring Redo Transport Authentication

(1) Tnsnames.ora

STEPHEN =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = Cluster-scan) (PORT = 1521))

(Connect_data =

(SERVER = dedicated)

(service_name = Stephen)

)

)

STANDBY =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = std) (PORT = 1521))

(Connect_data =

(SERVER = dedicated)

(service_name = standby)

)

)

(2) tnsping Command parses the network service name, the command must return OK.

At this point, the standby side is not configured to listen, can not be resolved, standby configuration and then test.

$ tnsping Standby

(3) password file

If there is no password file, the password file is created on one node and copied to the remaining nodes. Format:orapw<oracle_sid>

CD $ORACLE _home/dbs

Orapwd file=orapwstephen1 password=oracle ignorecase=y force=y

SCP orapwstephen1 node2: $ORACLE _home/dbs/orapwstephen2

3. Add Standby LogFiles

Requirements for adding standby logfile:

(1) Ensure that the log file size is the same on the primary and standby databases

(2) Determine the appropriate number of repository redo log file groups

Standby logfile Number = (number of logfile per thread +1) * Number of threads

(3) Check the maxlogfiles and Maxlogmembers parameters specified during CREATE database, which can be viewed by trace controlfile.

(4) RAC Environment Create standby logfile, specify thread# Create

Standby logfile per thread = number of logfile per thread + 1

Check the logfile of the current environment:

Set Lines pages 300

Col Member for A60

Select a.thread#,a.group#,b.member,b.type,a.bytes/1024/1024 MB from V$log a,v$logfile b where a.group#=b.group#

UNION ALL

Select a.thread#,a.group#,b.member,b.type,a.bytes/1024/1024 MB from V$standby_log a,v$logfile b where a.group#=b.group #;

Based on the query's logfile information, add standby logfile requirements above, add a reasonable standby logfile, and then use the SQL above to view the logfile of the current environment again:

ALTER DATABASE ADD standby logfile thread 1

Group 5 ' +data/stephen/onlinelog/standby05.log ' size 50M,

Group 6 ' +data/stephen/onlinelog/standby06.log ' size 50M,

Group 7 ' +data/stephen/onlinelog/standby07.log ' size 50M;

ALTER DATABASE ADD standby logfile thread 2

Group 8 ' +data/stephen/onlinelog/standby08.log ' size 50M,

Group 9 ' +data/stephen/onlinelog/standby09.log ' size 50M,

Group ' +data/stephen/onlinelog/standby10.log ' size 50M;

4. Modify the primary parameter file

Backup SPFile:

Create pfile= '/tmp/pfile.bak ' from SPFile;

Modify the following parameters, where Stephen,standby is the db_unqiue_name/tns-alias of Primary,standby, see the Detailed Parameters section:

Alter system set log_archive_config= ' dg_config= (stephen,standby) ' sid= ' * ';

Alter system set log_archive_dest_1= ' Location=+data/stephen/archivelog valid_for= (all_logfiles,all_roles) db_unique _name=stephen ' sid= ' *;

Alter system set log_archive_dest_2= ' Service=standby lgwr async valid_for= (online_logfiles,primary_role) db_unique_ Name=standby ' sid= ' *;

Alter system set LOG_ARCHIVE_MAX_PROCESSES=30 sid= ' * '; # Adjust the number according to demand

-- confirm the following parameters and modify them if they are not the default values:

Alter system set remote_login_passwordfile=exclusive scope=spfile sid= ' * ';

# remote_login_passwordfile=exclusive/shared

Alter system set log_archive_dest_state_1=enable sid= ' * ';

Alter system set log_archive_dest_state_2=enable sid= ' * ';

-- You can modify the archive log format to differentiate it from datafile:

Alter system set log_archive_format= '%t_%s_%r.arc ' scope=spfile sid= ' * ';

-- To prepare the role parameters:

Alter system set Fal_server=standby sid= ' * ';

Alter system set Standby_file_management=auto sid= ' * ';

Alter system set db_file_name_convert= '/oradata/standby ', ' +data/stephen/datafile ' scope=spfile sid= ' * ';

Alter system set log_file_name_convert= '/oradata/standby ', ' +data/stephen/onlinelog ' scope=spfile sid= ' * ';

# If you do not use it, you can disable OMF:

alter system reset db_create_file_dest sid= ' * ';

alter system reset DB_CREATE_ONLINE_LOG_DEST_n sid= ' * '; #n as a numeric variable

alter system reset db_recovery_file_dest sid= ' * ';

5. Open Archive mode

First verify that the current database is an archive mode, and if not, turn on archive mode.

Archive log list;

Srvctl Stop database-d Stephen

Srvctl Start database-d Stephen-o Mount

ALTER DATABASE Archivelog; -- execute at one node

ALTER DATABASE open; -- each node executes

6. Backup Primary Database

Rman Target/<<eof

Run{allocate channel C1 type disk;

Allocate channel C2 type disk;

Backup full database format '/backup/full_%u.bak ' plus archivelog;

SQL ' alter system switch logfile ';

Backup current controlfile for standby format '/backup/c_%u.bak ';

Release channel C1;

Release channel C2;

}

Eof

Standby database configure1. Configuring environment variables

Export Oracle_base=/oracle/app/oracle

Export Oracle_home=/oracle/app/oracle/product/11.2.0/db_1

Export Oracle_sid=standby

Export Nls_lang=american_america. Zhs16gbk

Export path= $ORACLE _home/bin: $PATH

Export ld_library_path= $ORACLE _home/lib # different platform variable names

2. Configuring Redo Transport Authentication

(1) Listener.ora

To configure static monitoring:

LISTENER =

(address_list=

(Address= (PROTOCOL=TCP) (HOST=STD) (port=1521))

)

Sid_list_listener=

(sid_list=

(sid_desc=

(Global_dbname=standby)

(Sid_name=standby)

(oracle_home=/oracle/app/oracle/product/11.2.0/db_1)

)

)

Enable monitoring:

Lsnrctl start

Lsnrctl status

(2) Tnsnames.ora

STEPHEN =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = Cluster-scan) (PORT = 1521))

(Connect_data =

(SERVER = dedicated)

(service_name = Stephen)

)

)

STANDBY =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = std) (PORT = 1521))

(Connect_data =

(SERVER = dedicated)

(service_name = standby)

)

)

(3) tnsping Command parses the network service name, the command must return OK.

$ tnsping Stephen

(4) password file

Using the Master Vault's password file:

SCP Node1: $ORACLE _home/dbs/orapwstephen1 $ORACLE _home/dbs/orapwstandby

3. Create a related directory

Mkdir-p $ORACLE _base/admin/standby/{adump,dpdump,pfile}

Mkdir-p/oradata/{standby,arch}

4. parameter file

Modified with primary pfile to ensure that some parameters are consistent with primary, note that the size of the main repository memory is appropriately adjusted for memory-related parameters.

SCP Node1:/tmp/pfile.bak $ORACLE _home/dbs/initstandby.ora

Modify the pfile to the desired standby pfile and create the SPFile. Pay particular attention to the following example parameter settings:

*.audit_file_dest= '/oracle/app/oracle/admin/standby/adump '

*.control_files= '/oradata/standby/control01.ctl '

*.cluster_database=false

*.db_name= ' Stephen '

*.db_unique_name= ' standby '

*.instance_name= ' standby '

*.service_names= ' standby '

*.fal_server= ' STEPHEN '

*.instance_number=1

*.local_listener= ' (address= (PROTOCOL=TCP) (HOST=STD) (port=1521)) '

*.log_archive_config= ' dg_config= (stephen,standby) '

*.log_archive_dest_1= ' Location=/oradata/arch valid_for= (all_logfiles,all_roles) Db_unique_name=standby '

*.log_archive_dest_2= ' Service=stephen lgwr async valid_for= (online_logfiles,primary_role) Db_unique_name=stephen '

*.log_archive_dest_state_1= ' ENABLE '

*.log_archive_dest_state_2= ' ENABLE '

*.log_archive_max_processes=30 # Adjust the number according to demand

*.log_archive_format= '%t_%s_%r.arc '

*.remote_login_passwordfile= ' Exclusive '

*.standby_file_management= ' AUTO '

*.thread=1

*.undo_management= ' AUTO '

*.undo_tablespace= ' UNDOTBS1 '

*.db_file_name_convert= ' +data/stephen/datafile ', '/oradata/standby '

*.log_file_name_convert= ' +data/stephen/onlinelog ', '/oradata/standby '

Cancel the following parameter settings:

#*.cluster_database_instances

#*.remote_listener

# If you do not use OMF, do not set the following parameters to disable OMF:

#*.db_create_file_dest

#*.db_create_online_log_dest_n #n as a numeric variable

#*.db_recovery_file_dest

Create SPFile:

Create SPFile from Pfile;

5. Recovering standby Controlfile

sql> startup Nomount;

rman> restore standby controlfile from '/backup/c_36qn6k6t_1_1.bak ';

6. Recovering Data files

Rac+asm to Single instance file system Dg,standby inconsistent with primary data file storage path.

Query the data file information for primary database:

Set Lines pages 300

Col name for A60

Col Member for A60

Select File#,name from V$datafile

UNION ALL

Select File#,name from V$tempfile;

Start the standby to mount stage and recover the data files:

rman> SQL ' ALTER DATABASE mount standby database ';

run{

Set newname for datafile 1 to '/oradata/standby/system01.dbf ';

Set newname for datafile 2 to '/oradata/standby/sysaux01.dbf ';

Set newname for DataFile 3 to '/oradata/standby/undotbs1.dbf ';

Set newname for datafile 4 to '/oradata/standby/undotbs2.dbf ';

Set newname for datafile 5 to '/oradata/standby/users01.dbf ';

Set newname for Tempfile 1 to '/oradata/standby/temp01.dbf ';

Restore database;

Switch datafile all;

Switch Tempfile all;

Recover database;

}

View Standby database log file:

Set Lines pages 300

Col Member for A60

Select a.thread#,a.group#,b.member,b.type,a.bytes/1024/1024 MB from V$log a,v$logfile b where a.group#=b.group#

UNION ALL

Select a.thread#,a.group#,b.member,b.type,a.bytes/1024/1024 MB from V$standby_log a,v$logfile b where a.group#=b.group #;

7. Application Log

Apply Archive log:

Recover managed standby Database disconnect;

Apply Redo logfile:

Recover managed Standby database using current logfile disconnect;

To cancel the application log:

Recover managed standby database cancel;

Open the database to read only mode and start real-time replication:

ALTER DATABASE open read only;

Recover managed Standby database using current logfile disconnect;

8. Observing log Transfers

Follow the alert log of Primary,standby database to see if there is an error, and you can view information about the application log.

Verify that standby applies the log:

--primary end more than a few times log, observe alert log information.

alter system switch logfile;

alter system switch logfile;

-- Watch the Master repository log sequence number

Archive log list;

--primary End Query V$archived_log view to confirm that the log is applied:

Set Lines pages 300

Col name for A20

Select Name,dest_id,thread#,sequence#,standby_dest,applied,registrar,completion_time from V$archived_log

where standby_dest= ' YES '

Order BY thread#,sequence#;

--primary the maximum log sequence number for the Primary,standby-side query is consistent:

Select ' Primary: ' DB Role ', Thread#,max (sequence#)

From V$archived_log

where standby_dest= ' NO '

GROUP BY thread#

Union

Select ' Standby: ' DB Role ', Thread#,max (sequence#)

From V$archived_log

where standby_dest= ' yes ' and applied= ' yes '

GROUP BY thread#

Order BY thread#;

oracle11g R2 "rac+asm→ Single Instance FS"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.