Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Key points of oracle 11g dg deployment rman

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Environmental introduction

Iphostnamesiddb_namedb_unique_namenet service name192.168.56.118oraclepyunhaipyunhaipyunhaipyunhaip192.168.56.117oraclesyunhaipyunhaipyunhaisyunhais

2. Modify hostname

Hostnamectl set-hostname oraclep

3. Db deployment

Master: create library, slave: do not create database

Even without dbca, the network and basic environment are still needed.

4. The main database enables archiving and sets the mandatory log force logging.

SQL > shutdown immediate

Stop database operation

Startup mount

Boot to mount state

Alter database archivelog

Open archiving

Alter database force logging

Force logging, that is, log information is generated for all operations in the database and written to the online redo log file.

Alter database open

Open the database

Archive log list

Want to view the archiving mode of the data

Select force_logging from v$database

Confirm whether it is a mandatory log

5. Add standby redo log to the main library

Select member from v$logfile

View redo and standby redo

Select * from v$log

Check the redo situation

Alter database add standby logfile group 21'/ u01 size size 50m

Alter database add standby logfile group 22'/ u01 size size 50m

Alter database add standby logfile group 23'/ u01 size size 50m

Alter database add standby logfile group 24'/ u01 size size 50m

Add a set of standby redo with a size of 50m. The group number here must not be duplicated with online redo. The size of the official environment file needs to be adjusted.

6. Configuration file modification

6.1. the main library pfile is created to make changes

SQL > create pfile from spfile

SQL > host

[oracle@oraclep ~] $cd $ORACLE_HOME/dbs

[oracle@oraclep dbs] $pwd

/ u01/app/oracle/product/11.2.0/db_1/dbs

Cat > > / u01/app/oracle/product/11.2.0/db_1/dbs/inityunhaip.ora > / u01/app/oracle/product/11.2.0/db_1/dbs/inityunhaip.ora shutdown immediate

SQL > create spfile from pfile

SQL > startup

SQL > ALTER USER SYS IDENTIFIED BY sys

Change the sys password for future rman connections

6.5. Copy the password file of the main library to the standby database

Scp orapwyunhaip 192.168.56.117:/u01/app/oracle/product/11.2.0/db_1/dbs/

7. Create relevant directories from the library

Strings spfileyunhaip.ora

To get the directory, I'm looking at the main library's

Mkdir-p / u01/app/oracle

Mkdir-p / u01/app/admin/yunhaip/ {a _ r _ e _ r _ u} dump

Mkdir-p / u01/app/oradata/yunhaip/

Mkdir-p / u01/app/fast_recovery_area/yunhaip/

8. Create a tnsnames.ora that is consistent with the master and slave.

Cat > > / u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora > / u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora create spfile from pfile

SQL > startup nomount

11. RMAN copies the primary library to the standby database

First, RMAN connects to the primary database and the standby database

Rman target sys/sys@yunhaip auxiliary sys/sys@yunhais

If there are any related errors, please pay attention to step 9. 4.

11.2. Use the duplicate command of RMAN to copy. The directory structure on both sides is the same, and the nofilenamecheck parameter needs to be added.

Duplicate target database for standby from active database nofilenamecheck

12. After the copy is completed, the slave library will be processed.

Select status from v$instance

Query whether the slave library is in MOUNTED state

Alter database recover managed standby database using current logfile disconnect from session

Open the real-time log application in the slave database

13. Observe the correct state of master and slave

13.1. Observe the alert log of the main database

Vim alert_yunhaip.log

Error 12154 received logging on to the standby found this error

13.2. Restart the main library

SQL > shutdown immediate

SQL > startup

13.3 observe the status of the main database:

SQL > select switchover_status,database_role from v$database

SWITCHOVER_STATUS DATABASE_ROLE

TO STANDBY PRIMARY

13.4. Observe the slave status

SQL > select switchover_status,database_role from v$database

SWITCHOVER_STATUS DATABASE_ROLE

NOT ALLOWED PHYSICAL STANDBY

14. Observe the synchronization by switching logs

14.1. Switch between the main library

SQL > archive log list

SQL > alter system switch logfile

SQL > archive log list

14.2. Observe from the library

SQL > archive log list

15. Open from the library so that users can read

Alter database recover managed standby database cancel

Alter database open

Alter database recover managed standby database using current logfile disconnect

[oracle@oracles ~] $sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 3 15:59:46 2019

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL > alter database recover managed standby database cancel

Database altered.

SQL > alter database open

Database altered.

SQL > alter database recover managed standby database using current logfile disconnect

Database altered.

SQL > exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

16. Experimental process

16.1. Observe the existing data from the slave database

[oracle@oracles ~] $sqlplus test/test

SQLPlus: Release 11.2.0.3.0 Production on Wed Jul 3 16:01:59 2019

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL > select from test

ID NUMS

1 2

SQL > exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@oracles ~] $exit

Log out

Connection to 192.168.56.117 closed.

16.2. Add new data to the main database

[oracle@oraclep trace] $sqlplus test/test

SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 3 16:02:19 2019

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL > insert into test values (2jue 2)

1 row created.

SQL > commit

Commit complete.

SQL > exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

16.3. Observe new data from the library

[oracle@oraclep trace] $ssh 192.168.56.117

Oracle@192.168.56.117's password:

Last login: Wed Jul 3 16:01:52 2019 from 192.168.56.118

[oracle@oracles ~] $sqlplus test/test

SQLPlus: Release 11.2.0.3.0 Production on Wed Jul 3 16:02:36 2019

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL > select from test

ID NUMS

1 2

2 2

Add:

Supplement 1. Start from the library in a read-only way

SQL > shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL > startup nomount

ORACLE instance started.

Total System Global Area 768294912 bytesFixed Size 2232312 bytesVariable Size 452984840 bytesDatabase Buffers 310378496 bytesRedo Buffers 2699264 bytesSQL > alter database mount standby database;Database altered.SQL > alter database recover managed standby database using current logfile disconnect from session;Database altered.SQL > alter database recover managed standby database cancel;Database altered.SQL > alter database open read only;Database altered.SQL > alter database recover managed standby database using current logfile disconnect from session Database altered.SQL > exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@oracles] $sqlplus test/test SQL*Plus: Release 11.2.0.3.0 Production on Thu Jul 4 09:32:48 2019Copyright (c) 1982, 2011, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL > select * from test; ID NUMS--1 2 2 2 3 2 4SQL > select * from test ID NUMS--1 2 2 2 3 2 4 2 5SQL >

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report