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

Digging holes in the cloud of Oracle 12c dataguard-deploying oracle 12c to the cloud for VIP business at an airport

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

Share

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

Project requirements

It is said that the existing environment is multi-node RAC, and the management cost is high, mainly reflected in that there is no professional and technical people to maintain the infrastructure. After migrating to the cloud, infrastructure maintenance is saved. And after the capacity expansion is easy, remote maintenance and so on is also much more convenient than the physical environment to the field operation.

However, on the cloud, the two prerequisites for oracle RAC implementation-shared storage and heartbeat network-are not officially supported, so deploying oracle RAC on the cloud for production environment is not a good solution. After several rounds of discussion, it is agreed to deploy single instance oracle 12c in Baidu Cloud to protect data availability in a dataguard manner.

Of course, the system load capacity of a single instance is much worse than that of RAC. For the same two nodes, both nodes of RAC provide external read and write services, while for single instance dataguard, only one device provides external services, while the other can only be used as a backup to synchronize data with the main database. Considering the small amount of actual business visits, this is also within an acceptable range.

infrastructure

Two CVMs are temporarily bound to the public network ip,20M for exclusive bandwidth.

The resource configuration is: cpu 8core, 32 GB of memory, 50 GB of system disk, and 1000 GB of cloud disk.

The CVM does not have swap by default, so use part of the 1000G cloud disk as swap, and the rest for installation directory and data directory.

The operating system version has been chosen by others, the version is CentOS release 6.8, I have no autonomy, otherwise I will choose centos 7. But 6 is fine, turning off the firewall is not as cumbersome as centos 7.

Several sets of oracle 11g have been deployed in Aliyun to use centos 7. When executing the formal installation instruction. / runInstaller, you need to execute export DISPLAY=:1 with the oracle account, otherwise you will not be able to proceed to the next step. Refer to my previous article, "Ali Cloud deployment oracle 11g", and the connection address is https://blog.51cto.com/sery/2107701.

The software uses oracle 12c, has the official authorization, lets me go to the official website to download. This is really troublesome, first download to your own PC (you can't use wget directly, you need to enter a user name and password to verify-maybe I don't know how to splice the downloaded url on the command line), and then upload it to the cloud. It takes too much time to download and upload files close to 4G, alas!

Preparation before oracle installation

The main steps are: prepare the exchange partition and data partition, modify the hostname, modify the system configuration and dependency package, and prepare the desktop environment.

◎ prepares to exchange partitions and data partitions

◆ prepares to swap partitions

Fdisk / dev/vdb

Mkswap / dev/vdb1

Swapon / dev/vdb1

During the Fdisk operation, the partition code is selected as "82" and the size is 18G. After you have done this, check to see if it works with the command free-m.

As you can see from the figure above, the swap partition is indeed loaded into the system. In order to load the swap partition with the boot of the system, you need to modify the file / etc/fstab, add the description, etc., and post it after adding the data partition.

◆ prepares data partition

Fdisk / dev/vdb

Mkfs.ext4 / dev/vdb2

Mkdir / u01

Mount / dev/vdb2 / u01

For the hook to take effect permanently, you need to make changes to the file / etc/fstab. After adding the swap partition and data partition, the contents of the / etc/fstab file are as follows:

After the modification, restart the system and execute it with df-h and free-m to see if the swap and data partitions are mounted automatically.

◎ modifies hostname

The hostname of the cloud server is always inexplicable and looks very uncomfortable. Changing the host name has two purposes, one is that the login system is easy to identify, and the other is that it is easier to use short words than ip addresses to communicate between servers. It is important to note that the hostname may be modified differently depending on the version of the operating system. Centos 7, for example, has a / etc/hostname file to associate with. For centos 6 and previous versions, the files related to the hostname are probably: / etc/sysconfig/network,/etc/sysconfig/network-scriptes/ifcfg-eth0,/etc/hosts. Sometimes when something goes wrong, it is very likely that the host name is set in these files. It is recommended to check them one by one. The / etc/hosts contents of only two CVMs are listed below:

[root@oradb162 ~] # more / etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6

# 192.168.0.4 instance-umns7cw3-2 instance-umns7cw3-2.novalocal

192.168.0.4 oradb162

192.168.0.5 oradb95

[root@oradb95 ~] # more / etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.0.5 oradb95 oradb95.novalocal

192.168.0.4 oradb162

After the change, if the implementation of hostname has no effect, check the settings of the files related to the hostname again, and then restart the system. After the hostname takes effect, the set name is used instead of the ip address, and the two computers ping each other to test network connectivity.

◎ prepares the desktop environment

In most cases, I install oracle from remote desktop, which helps to control the entire installation process and intuitively understand the installation progress and problems. The desktop environment consists of xwindow and vncserver. By default, these two tools are not installed on CVM. Many practices have proved that vncserve and xwindow are the best combination, which can be used after installation, without blue screen or gray screen. The specific installation steps are as follows:

Yum groupinstall "X Window System"Desktop"-y

Yum install tigervnc-server-y

After installing these two tools, you just need to start vncserver, set the user name and password, and pay attention to the output, which you need to use when connecting with the client.

After the successful connection, there is no black screen gray screen, congratulations!

◎ modifies system-related configuration and dependency packages

The steps are cumbersome, because I often have to install and deploy oracle, so I write a script that is valid for both 11g and 12c, which contains:

[root@oradb95 ~] # more oracle_rep.bash

#! / bin/bash

# writed by sery 2012-05-16

# #

# install depending packages #

# #

Yum install gcc* gcc-* gcc-c++-* glibc-devel-* glibc-headers-* compat-libstdc*\

Libstdc* elfutils-libelf-devel* libaio-devel*\

Sysstat* unixODBC-* pdksh-* ksh compat-libcap1

# #

# add groups,user and create dir #

# #

/ usr/sbin/groupadd-g 501 oinstall

/ usr/sbin/groupadd-g 502 dba

Useradd-u 1000-g oinstall-G dba oracle

Mkdir / u01/app/

Mkdir-p / u01/app/oraInventory

Mkdir-p / u01/app/oracle

Chown-R oracle:oinstall / u01/app

Chmod-R 775 / u01/app

#

# modify sysctl.conf #

#

Cat > > / etc/sysctl.conf / etc/security/limits.conf > / etc/pam.d/login

# # #

# setting user oracle env #

# # #

Cat > > / home/oracle/.bash_profile archive log list

Database log mode No Archive Mode

Automatic archival Disabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 11

Current log sequence 13

SQL > alter database archivelog

Database altered.

SQL > archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 11

Next log sequence to archive 13

Current log sequence 13

SQL > alter database open

Database altered.

2. Force logging forces logging: first check whether it is enabled, if not (it can be performed in the database open state). The steps are as follows:

SQL > select force_logging from v$database

FORCE_LOGGING

-

NO

SQL > alter database force logging

Database altered.

SQL > select force_logging from v$database

FORCE_LOGGING

-

YES

◎ prepares control files for the library

Do the following on the main library, store the generated file in a temporary location, and then move it to the appropriate location when all the other files are there. I refer to a lot of documentation and are in the creator's gadget, but in fact I use rman replication to create a repository, and I don't need this control file at all. Analyze the reason, it should be like this: the standby library starts the instance in the way of startup nomount pfile and only reads the parameter files; the main library connects the main and standby libraries with rman to instruct "duplicate target database" to copy the required files from the main library, including control files.

SQL > alter database create standby controlfile as'/ home/oracle/gdbd.ctl'

Database altered.

◎ main library to create standby redo log

Try to be consistent with the existing log file size of the main library, and create no less groups than the existing ones of the system.

Check the current log group size

SQL > select GROUP#,BYTES/1024/1024 size_M,STATUS,ARCHIVED from v$log

GROUP# SIZE_M STATUS ARC

1 200 CURRENT NO

2 200 INACTIVE YES

3 200 INACTIVE YES

Check the storage path

SQL > select MEMBER from v$logfile

MEMBER

/ u01/app/oracle/oradata/GBDB/onlinelog/o1_mf_3_fl1mvv1j_.log

/ u01/app/oracle/fast_recovery_area/gbdb/GBDB/onlinelog/o1_mf_3_fl1mvvkc_.log

/ u01/app/oracle/oradata/GBDB/onlinelog/o1_mf_2_fl1mvv0q_.log

/ u01/app/oracle/fast_recovery_area/gbdb/GBDB/onlinelog/o1_mf_2_fl1mvvfs_.log

/ u01/app/oracle/oradata/GBDB/onlinelog/o1_mf_1_fl1mvty3_.log

/ u01/app/oracle/fast_recovery_area/gbdb/GBDB/onlinelog/o1_mf_1_fl1mvvgd_.log

6 rows selected.

# two members of a group with different paths and identical size and content.

[root@oradb162 ~] # diff / u01/app/oracle/oradata/GBDB/onlinelog/o1_mf_3_fl1mvv1j_.log / u01/app/oracle/fast_recovery_area/gbdb/GBDB/onlinelog/o1_mf_3_fl1mvvkc_.log

[root@oradb162 ~] # du / u01/app/oracle/fast_recovery_area/gbdb/GBDB/onlinelog/o1_mf_3_fl1mvvkc_.log

204804 / u01/app/oracle/fast_recovery_area/gbdb/GBDB/onlinelog/o1_mf_3_fl1mvvkc_.log

[root@oradb162 ~] # du / u01/app/oracle/oradata/GBDB/onlinelog/o1_mf_3_fl1mvv1j_.log

204804 / u01/app/oracle/oradata/GBDB/onlinelog/o1_mf_3_fl1mvv1j_.log

Create a new log group and store it in two locations

SQL > alter database add standby logfile group 4 ('/ u01 size size) 4 ('/ u01 onlinelog Universe) size 200m

Database altered.

SQL > alter database add standby logfile group 5 ('/ u01 onlinelog alter database add standby logfile group) size 200m

Database altered.

SQL > alter database add standby logfile group 6 ('/ u01 onlinelog alter database add standby logfile group) size 200m

Database altered.

SQL > alter database add standby logfile group 7 ('/ u01 onlinelog alter database add standby logfile group) size 200m

Database altered.

Verify the group created

SQL > select group#,thread#,sequence#,archived,status from v$standby_log

GROUP# THREAD# SEQUENCE# ARC STATUS

-

4 0 0 YES UNASSIGNED

5 0 0 YES UNASSIGNED

6 0 0 YES UNASSIGNED

7 0 0 YES UNASSIGNED

◎ prepares to initialize the parameter file

Generate files on the main library, copy them to the standby library, and then both parameter files need to be modified to meet the actual requirements. If you modify the parameters on the main library, you can execute the alter statement directly in sqlplus, but this is not safe. If you make a mistake, it is easy to cause pressure on yourself. It is recommended that you make an original backup before modifying the parameter file, and then modify the parameter file. In case an exception occurs in the server parameter file (spfile) generated from the modified parameter file in the future, the parameter file backed up will be a medicine for regret.

◆ executes the following instructions to generate a parameter file:

SQL > create pfile='/home/oracle/initgd.ora' from spfile

File created.

Make an original backup before modification

[oracle@oradb162 ~] $pwd

/ home/oracle

[oracle@oradb162 ~] $cp initgd.ora initgd.ora.bk20180617

Copy a parameter file initgd.ini to the / home/oracle directory of the standby server and wait for modification.

◆ modifies the main library parameter file / home/oracle/initgb.ora

Add the following to the source file (the line is too long, some lines are automatically wrapped, please note when writing):

* .db_unique_name='oradb162'

* .fal_client='oradb162'

* .fal_server='oradb95'

* .log_archive_config='DG_CONFIG= (oradb162,oradb95)'

* .log_archive_dest_1='LOCATION=/u01/app/oracle/fast_recovery_area/gbdb/ VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=oradb162'

* .log_archive_dest_2='SERVICE=oradb95 LGWR ASYNC VALID_FOR= (ALL_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=oradb95'

* .log_archive_dest_state_1='ENABLE'

* .log_archive_dest_state_2='ENABLE'

* .standby_file_management='AUTO'

◆ preparation library parameter file / home/oracle/initgb.ora

Copy the file from the main library, using the same path. Put the required files in the / home/oracle directory, there will be no lack of permissions, but will not be mixed with other data files, and when dataguard is running, these files will no longer be used and will not interfere with later maintenance.

The contents of the standby library parameter file / home/oracle/initgb.ora are as follows, which are different from the main library, especially marked with the background color.

[oracle@oradb95 ~] $more initgb.ora

Gbdb.__data_transfer_cache_size=0

Gbdb.__db_cache_size=7918845952

Gbdb.__inmemory_ext_roarea=0

Gbdb.__inmemory_ext_rwarea=0

Gbdb.__java_pool_size=67108864

Gbdb.__large_pool_size=100663296

Gbdb.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment

Gbdb.__pga_aggregate_target=3388997632

Gbdb.__sga_target=10099884032

Gbdb.__shared_io_pool_size=536870912

Gbdb.__shared_pool_size=1442840576

Gbdb.__streams_pool_size=0

* .audit_file_dest='/u01/app/oracle/admin/gbdb/adump'

* .audit_trail='db'

* .compatible='12.2.0'

* .control_files='/u01/app/oracle/oradata/GBDB/controlfile/o1_mf_fl1mvrh5_.ctl','/u01/app/oracle/fast_recovery_area/gbdb/GBDB/controlfile

Controlfile/o1_mf_fl1mvrls_.ctl'

* .db_block_size=8192

* .db_create_file_dest='/u01/app/oracle/oradata'

* .db_name='gbdb'

* .db_recovery_file_dest='/u01/app/oracle/fast_recovery_area/gbdb'

* .db_recovery_file_dest_size=8016m

* .diagnostic_dest='/u01/app/oracle'

* .dispatchers=' (PROTOCOL=TCP) (SERVICE=gbdbXDB)'

* .local_listener='LISTENER_GBDB'

* .open_cursors=300

* .pga_aggregate_target=3209m

* .processes=640

* .remote_login_passwordfile='EXCLUSIVE'

* .sga_target=9627m

* .undo_tablespace='UNDOTBS1'

* .db_unique_name='oradb95'

* .fal_client='oradb95'

* .fal_server='oradb162'

* .log_archive_config='DG_CONFIG= (oradb162,oradb95)'

* .log_archive_dest_1='LOCATION=/u01/app/oracle/fast_recovery_area/gbdb/ VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=oradb95'

* .log_archive_dest_2='SERVICE=oradb162 LGWR ASYNC VALID_FOR= (ALL_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=oradb162'

* .log_archive_dest_state_1='ENABLE'

* .log_archive_dest_state_2='ENABLE'

* .standby_file_management='AUTO'

The resource configuration, operating system version, oracle software and directory structure of the two CVMs (master and slave database) are exactly the same, so there is no need to convert logs and data files. You must write the parameter file carefully. I stepped on a big hole here and spent the whole Dragon Boat Festival on it.

There are several values in the parameter file, which should be paid special attention to. Db_name, db_unique_name, service, how to fill in? It is important to figure out which projects you want to be associated with.

(1) db_name: the master and slave libraries have the same name. The value used here is defined in the gbdb,oracle system account environment variable .bash _ profile.

(2) db_unique: the main database is different from the slave database. The main database is defined as oradb162 and the slave database is oradb95, which is the same as or different from the system's / etc/hosts definition. You can also set it in the oracle system account environment variable .bash _ profile.

(3) service: this is the most likely to cause confusion. Personally, we should take the value from tnsname.ora, taking that net service name, not the service in the code block (the line at the top of the code block, without parentheses, and the real service, using the same setting gbdb, is also set to the same as sid).

I made a low-level mistake in the parameter file log_archive_dest_1 line, because this line is very long, converted to the next line, worried about not a positive line, so the use of delete, did not pay attention to delete the DB_UNIQUE_NAME=oradb162 character "a" to be deleted, into DB_UNIQUE_NAME=ordb162, after the configuration, life and death can not synchronize the data. Check the oracle alarm log and find the information that cannot be found by the log1 target. You always thought it was due to the listener monitor or the local name service tnsnames setting. Sqlplus executes show parameter log_archive_dest to get some useful information.

◆ slave server to create the required directory

These directories are created based on the parameter file / home/oracle/initgb.ora, which needs to be checked one by one.

1. Create a control file directory:

[oracle@oradb95 ~] $mkdir / u01/app/oracle/oradata/GBDB/controlfile-p

[oracle@oradb95 ~] $mkdir / u01/app/oracle/fast_recovery_area/gbdb/GBDB/controlfile-p

2. Create an archive log directory:

[oracle@oradb95 ~] $mkdir / u01/app/oracle/fast_recovery_area/gbdb-p

This step is repeated, and it was already created when the control file directory was created.

3. Create a directory of audit files:

[oracle@oradb95] $mkdir-p / u01/app/oracle/admin/gbdb/adump

◆ preparation database server prepares password files and control files

Both files come from the main library server and are synchronized or copied directly. Be careful not to change the owners of the files, that is, the owners of these files are oracle and oinstall.

1. According to the definition of the parameter file, we need to synchronize the control files to the directory respectively (this step is actually superfluous) / u01applicaloracleandoradataandGBDBcontrolfileSequenceGb01apaplyoracleandfastrecoveryparadareaUnibdbUniGBDBUnicontrolfile/.

[oracle@oradb95 ~] $cp gdbd.ctl / u01/app/oracle/oradata/GBDB/controlfile [oracle@oradb95 ~] $cp gdbd.ctl / u01/app/oracle/fast_recovery_area/gbdb/GBDB/controlfile/

2. Copy the database password file to directory / u01/app/oracle/product/12.2.0/dbs.

[oracle@oradb95 ~] $cp orapwgbdb / u01/app/oracle/product/12.2.0/dbs

The location of the document must be in accordance with the definition and oracle regulations. Some people write documents, do not emphasize, a random paste; in which machine operation, host naming, ambiguous, bring a lot of trouble and trouble to beginners.

In fact, it is enough to have parameter files and password files in the repository. If an exception occurs during database replication, it is most likely that the directory of the repository has not been created, just follow the prompts to create it. The control file will be copied automatically, so there is no need to do it manually.

◎ copies the database to the standby library

It is carried out in five steps in an orderly manner.

The first step of ◆: the main database starts the instance with the parameter mount:

SQL > startup mount pfile='/home/oracle/initgb.ora'

ORACLE instance started.

Total System Global Area 1.0100E+10 bytes

Fixed Size 12170040 bytes

Variable Size 1979714760 bytes

Database Buffers 8086618112 bytes

Redo Buffers 21381120 bytes

Database mounted.

If there is something wrong with the parameter file, replace it with the original backup one, which can be restored to the normal state, which is safer than changing the parameters directly in sql.

In the second step of ◆, the slave database starts the oracle instance. Be sure to install the oracle software, copy the password file of the main library to the corresponding location, and the parameter file, the location is arbitrary, can be read on the line.

[oracle@oradb95 ~] $sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Tue Jun 19 12:59:58 2018

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

Connected to an idle instance.

SQL > startup nomount pfile='/home/oracle/initgb.ora'

ORACLE instance started.

Total System Global Area 1.0100E+10 bytes

Fixed Size 12170040 bytes

Variable Size 1979714760 bytes

Database Buffers 8086618112 bytes

Redo Buffers 21381120 bytes

Note: the main library is the mount parameter and the standby library is nomount. Nomount does not require the use of control files.

In the third step of ◆, rman connects the master and slave libraries, which is done on the main library:

[oracle@oradb162 oradata] $rman target sys/Oradb_162@oradb162 auxiliary sys/Oradb_162@oradb95

Recovery Manager: Release 12.2.0.1.0-Production on Tue Jun 19 12:46:55 2018

Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.

Connected to target database: GBDB (DBID=2214703447, not open)

Connected to auxiliary database: GBDB (not mounted)

Note: only the service name after the @ connection string is different, and the rest should be the same. To avoid confusion, it can also be simplified to "rman target / auxiliary sys/Oradb_162@oradb95".

The fourth step of ◆ is to copy the database to the standby database or to execute it in the main database, right at the rman prompt.

RMAN > duplicate target database for standby from active database nofilenamecheck

. A large amount of output, slightly...

This step is prone to problems, and the most likely reason to pay attention to the output is that the required directories are not created by hand. In addition, if you have the same idea as I do (the structure of the main and standby directories is the same, and the oracle sid is the same), add the parameter "nofilenamecheck" when copying with rman.

Step 5 of ◆, the main library opens the database.

SQL > alter database open

Database altered.

◎ starts the standby library to synchronize it with the main library

SQL > ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION

Database altered.

After copying the database, the standby database switches itself to mount state, so there is no need for human intervention.

◎ verifies the synchronization status of master and slave

To be violent, create a tablespace on the main library, wait a moment, and check the generation of files on both sides.

SQL > create tablespace WUHUSER datafile'/ u01 size size 10G

Log in to the standby library and check the directory to see if the data file is automatically generated.

[oracle@oradb95 oradata] $pwd

/ u01/app/oracle/oradata

[oracle@oradb95 oradata] $ls-al

Total 4194332

Drwxr-xr-x 4 oracle oinstall 4096 Jun 19 10:43.

Drwxrwxr-x 10 oracle oinstall 4096 Jun 18 14:15..

Drwxr-xr-x 3 oracle oinstall 4096 Jun 18 22:17 gbdb

Drwxr-xr-x 3 oracle oinstall 4096 Jun 18 15:27 GBDB

-rw-r- 1 oracle oinstall 4294975488 Jun 19 13:19 wuhuser01.dbf

At the same time, check the oracle alarm logs on both sides for further verification. Add another method, the main and standby database to check the filing situation.

Main library execution

SQL > alter system switch logfile

System altered

SQL > select SEQUENCE#,FIRST_TIME,NEXT_TIME, APPLIED from v$archived_log

... Omit some...

SEQUENCE# FIRST_TIM NEXT_TIME APPLIED

--

46 19-JUN-18 19-JUN-18 NO

46 19-JUN-18 19-JUN-18 YES

47 19-JUN-18 19-JUN-18 NO

47 19-JUN-18 19-JUN-18 YES

48 19-JUN-18 19-JUN-18 NO

48 19-JUN-18 19-JUN-18 NO

94 rows selected.

Prepare for database execution

Select SEQUENCE#,FIRST_TIME,NEXT_TIME, APPLIED from v$archived_log

... Omit some...

SEQUENCE# FIRST_TIM NEXT_TIME APPLIED

--

37 19-JUN-18 19-JUN-18 YES

38 19-JUN-18 19-JUN-18 YES

39 19-JUN-18 19-JUN-18 YES

40 19-JUN-18 19-JUN-18 YES

41 19-JUN-18 19-JUN-18 YES

42 19-JUN-18 19-JUN-18 YES

43 19-JUN-18 19-JUN-18 YES

44 19-JUN-18 19-JUN-18 YES

45 19-JUN-18 19-JUN-18 YES

46 19-JUN-18 19-JUN-18 YES

47 19-JUN-18 19-JUN-18 YES

SEQUENCE# FIRST_TIM NEXT_TIME APPLIED

--

48 19-JUN-18 19-JUN-18 IN-MEMORY

34 rows selected.

Dataguard switching between active and standby roles

In order to ensure reliability, it is necessary to carry out main library-> preparation library, preparation library-> main library; original main library-> main library, original library-> backup library. Can change the past can also change back, only then is a good hand.

Switching has the order of operation. You need to operate in the main database to make it a standby database, and then you can switch in the standby database.

Switching from ◎ master library to standby library

View the switching status of the main library:

SQL > select switchover_status from v$database

SWITCHOVER_STATUS

-

TO STANDBY

Master library modification library:

SQL > alter database commit to switchover to standby

Database altered.

The main database starts the instance again (now the role is standby backup library)

SQL > startup mount

ORACLE instance started.

Total System Global Area 1.0100E+10 bytes

Fixed Size 12170040 bytes

Variable Size 1979714760 bytes

Database Buffers 8086618112 bytes

Redo Buffers 21381120 bytes

Database mounted.

SQL > ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION

Database altered.

Change the ◎ standby database to the master database

If the main library is alive, execute "select switchover_status from vested database;" and the output is "NOT ALLOWED". After the conversion from the main library to the standby library is completed, execute this instruction, and the output is as follows:

SQL > select switchover_status from v$database

SWITCHOVER_STATUS

-

TO PRIMARY

Switch the role of standby library to the main library

SQL > alter database commit to switchover to primary

Database altered.

Don't forget to open the database.

SQL > alter database open

Database altered.

Repeat the above steps and restore the role. To prevent accidents, I strongly recommend that they add another CVM and install the oracle. If the main database fails, immediately upgrade the standby database to the primary database, and at the same time use the reserved one as a database service to make it a new standby standby database. After the failure of the main library has been repaired, prepare the oracle and keep it for backup.

Lao Tian has something to say.

Recently, I was invited to publish "A record of load balancers" in the 51CTO blog column, relying on more than 10 years of IT operation and maintenance experience, based on practical work experience, to introduce the implementation of load balancer in different scenarios, as well as the daily maintenance of load balancer.

This column is suitable for operation and maintenance engineers who have been wandering in the primary stage of operation and maintenance, as well as for technology enthusiasts who are interested in understanding and learning about load balancing. After learning this series of courses with Lao Tian, it is not only a knowledge, but also a shortcut for salary increase, promotion and entry into the company you like.

"A master of load balancing"

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