Primary library initial instantiation
Only initial instantiation of the primary database is required to build a Dameng active standby database. If there are instances and data in the primary database, the original database can be used. Now select the data copy method to synchronize instance data, so only the primary database instance is initialized
// An highlighted block su dmdba; cd /home/dmdba/dmdbms/bin ./dminit PATH=/home/dmdba/data/ CHARSET=1
After successful initialization, it will start in normal mode and exit once
For the newly initialized library, the foreground is used for the first startup
// An highlighted block cd /home/dmdba/dmdbms/bin ./ dmserver /home/dmdba/data/DAMENG/dm.ini
Then create a new window and start the database under the additional recording bin / of Dameng installation
// An highlighted block cd /home/dmdba/dmdbms/bin ./disql SYSDBA/SYSDBA@LOCALHOST:5236
Close the process after startup
Turn off available:
./ DmService stop or use ps -ef|grep dmser to check the port number, and then kill -9 port number to close the process
Offline backup restore
- Both the active and standby computers should shut down the database normally
- Offline backup on host
// An highlighted block ./dmrman CTLSTMT="BACKUP DATABASE '/home/dmdba/data/DAMENG/dm.ini' FULL TO BACKUP_FILE1 BACKUPSET '/home/dmdba/data/BACKUP_FILE_01'"
3. Copy the backup file to the machine where the backup database is located
With command
// An highlighted block scp -r BACKUP_FILE_01/ 192.168.78.142:/home/dmdba/data/
- Perform offline database restore and recovery (3t commands run in sequence)
// An highlighted block ./dmrman CTLSTMT="RESTORE DATABASE '/dm/data/DAMENG/dm.ini' FROM BACKUPSET '/dm/data/BACKUP_FILE_01'" ./dmrman CTLSTMT="RECOVER DATABASE '/dm/data/DAMENG/dm.ini' FROM BACKUPSET '/dm/data/BACKUP_FILE_01'" ./dmrman CTLSTMT="RECOVER DATABASE '/dm/data/DAMENG/dm.ini' UPDATE DB_MAGIC"
Check data consistency
1. Start the database in the form of mount in the directory / opt/dmdbms/bin / of the primary and standby databases respectively
2. Start the command line tool dialql respectively
// An highlighted block cd /home/dmdba/dmdbms/bin ./disql SYSDBA/SYSDBA SQL>select file_LSN, cur_LSN from v$rlog; SQL>select permanent_magic;
View standby database file_LSN value, cur_ Whether the LSN value is consistent with the permanent value, including the primary and standby database file_LSN value and cur_ The LSN value should be the same (four groups of values are the same), and the persistent value of the primary and standby databases should be the same.
When the values are consistent, close each instance normally
Configure master library profile
Configure DM ini
// An highlighted block cd /home/dmdba/data/DAMENG vi dm.ini
In DM Ini to find the following parameter modification
INSTANCE_NAME = GRP1_RT_01
PORT_NUM = 32141 # database instance listening port
DW_INACTIVE_INTERVAL = 60 # receive daemon message timeout
ALTER_MODE_STATUS = 0 # manual modification of instance mode / status / OGUID is not allowed
ENABLE_OFFLINE_TS = 2 # no spare offline tablespace is allowed
MAL_INI = 1 # turn on mal system
ARCH_INI = 1 # open archive configuration
RLOG_SEND_APPLY_MON = 64 # statistics of the latest 64 log sending information
Configure dmmal ini
// An highlighted block cd /home/dmdba/data/DAMENG vi dmmal.ini MAL_CHECK_INTERVAL = 5 #MAL link detection interval MAL_CONN_FAIL_INTERVAL = 5 #Determine the disconnection time of MAL link [MAL_INST1] MAL_INST_NAME = GRP1_RT_01 #Instance name, and DM Instance in ini_ Name consistent MAL_HOST = 192.168.78.132 #The MAL system listens to the IP address of the TCP connection MAL_PORT = 61141 #MAL system listens to the port of TCP connection MAL_INST_HOST = 192.168.78.132 #External service IP address of the instance MAL_INST_PORT = 32141 #The external service port of the instance, and DM Port in ini_ Num consistent MAL_DW_PORT = 52141 #The local daemon of the instance listens to the port of the TCP connection MAL_INST_DW_PORT = 33141 #The port on which the instance listens for daemon TCP connections [MAL_INST2] MAL_INST_NAME = GRP1_RT_02 MAL_HOST = 192.168.78.134 MAL_PORT = 61142 MAL_INST_HOST = 192.168.78.134 MAL_INST_PORT = 32142 MAL_DW_PORT = 52142 MAL_INST_DW_PORT = 33142 [MAL_INST3] MAL_INST_NAME = GRP1_LOCAL_01 #Instance name, and DM Instance in ini_ Name consistent MAL_HOST = 192.168.78.134 #The MAL system listens to the IP address of the TCP connection MAL_PORT = 61143 #MAL system listens to the port of TCP connection MAL_INST_HOST = 192.168.78.134 #External service IP address of the instance MAL_INST_PORT = 32143 #The external service port of the instance, and DM Port in ini_ Num consistent MAL_DW_PORT = 52143 #The daemon corresponding to the instance listens to the port of the TCP connection MAL_INST_DW_PORT = 33143 #The port on which the instance listens for daemon TCP connections
Configure dmarch ini
// An highlighted block cd /home/dmdba/data/DAMENG vi dmarch.ini #DaMeng Database Archive Configuration file #this is comments ARCH_WAIT_APPLY = 0 [ARCHIVE_REALTIME] ARCH_TYPE = REALTIME ARCH_DEST = GRP1_RT_02 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = /home/dmdba/data/DAMENG/arch ARCH_FILE_SIZE = 128 ARCH_SPACE_LIMIT = 0 ARCH_FLUSH_BUF_SIZE = 0 [ARCHIVE_ASYNC] ARCH_TYPE = ASYNC #Asynchronous archive type ARCH_DEST = GRP1_LOCAL_01 #Asynchronous archive target instance name ARCH_TIMER_NAME = RT_TIMER #Timer name, and dmtimer The names in ini are consistent
Configure dmwatcher ini
// An highlighted block cd /home/dmdba/data/DAMENG vi dmwatcher.ini [GRP1] DW_TYPE = GLOBAL #Global daemon type DW_MODE = AUTO #Automatic switching mode DW_ERROR_TIME = 10 #Remote daemon failure determination time INST_RECOVER_TIME = 60 #The interval between the main library daemon starting recovery INST_ERROR_TIME = 10 #Local instance fault determination time INST_OGUID = 453331 #Unique OGUID value of daemon INST_INI = /home/dmdba/data/DAMENG/dm.ini #dm.ini configuration file path INST_AUTO_RESTART = 1 #Turn on the auto start function of the instance INST_STARTUP_CMD = /home/dmdba/dmdbms/bin/dmserver #Command line startup RLOG_SEND_THRESHOLD = 0 #Specifies the time threshold for sending logs from the primary database to the standby database. It is closed by default RLOG_APPLY_THRESHOLD = 0 #Specifies the time threshold of the backup database replay log. It is off by default
Start the main library in Mount mode
// An highlighted block cd /home/dmdba/dmdbms/bin ./dmserver /dm/data/DAMENG/dm.ini mount
Set OGUID
Start the command line tool dialql, log in to the main library and set the OGUID value
// An highlighted block SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1); SQL>sp_set_oguid(453331); SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
Modify database schema
// An highlighted block SQL>alter database primary;
Configure standby database
Operate on the standby machine
Configure DM ini
INSTANCE_NAME = GRP1_RT_02
PORT_NUM = 32142 # database instance listening port
DW_INACTIVE_INTERVAL = 60 # receive daemon message timeout
ALTER_MODE_STATUS = 0 # manual modification of instance mode / status / OGUID is not allowed
ENABLE_OFFLINE_TS = 2 # no spare offline tablespace is allowed
MAL_INI = 1 # turn on mal system
ARCH_INI = 1 # open archive configuration
RLOG_SEND_APPLY_MON = 64 # statistics of the latest 64 log replays
Configure dmmal ini
// An highlighted block MAL_CHECK_INTERVAL = 5 #MAL link detection interval MAL_CONN_FAIL_INTERVAL = 5 #Determine the disconnection time of MAL link [MAL_INST1] MAL_INST_NAME = GRP1_RT_01 #Instance name, and DM Instance in ini_ Name consistent MAL_HOST = 192.168.78.132 #The MAL system listens to the IP address of the TCP connection MAL_PORT = 61141 #MAL system listens to the port of TCP connection MAL_INST_HOST = 192.168.78.132 #External service IP address of the instance MAL_INST_PORT = 32141 #The external service port of the instance, and DM Port in ini_ Num consistent MAL_DW_PORT = 52141 #The daemon corresponding to the instance listens to the port of the TCP connection MAL_INST_DW_PORT = 33141 #The port on which the instance listens for daemon TCP connections [MAL_INST2] MAL_INST_NAME = GRP1_RT_02 MAL_HOST = 192.168.78.134 MAL_PORT = 61142 MAL_INST_HOST = 192.168.78.134 MAL_INST_PORT = 32142 MAL_DW_PORT = 52142 MAL_INST_DW_PORT = 33142 [MAL_INST3] MAL_INST_NAME = GRP1_LOCAL_01 #Instance name, and DM Instance in ini_ Name consistent MAL_HOST = 192.168.78.134 #The MAL system listens to the IP address of the TCP connection MAL_PORT = 61143 #MAL system listens to the port of TCP connection MAL_INST_HOST = 192.168.78.134 #External service IP address of the instance MAL_INST_PORT = 32143 #The external service port of the instance, and DM Port in ini_ Num consistent MAL_DW_PORT = 52143 #The daemon corresponding to the instance listens to the port of the TCP connection MAL_INST_DW_PORT = 33143 #The port on which the instance listens for daemon TCP connections
Configure dmarch ini
// An highlighted block #DaMeng Database Archive Configuration file #this is comments ARCH_WAIT_APPLY = 0 [ARCHIVE_REALTIME] ARCH_TYPE = REALTIME #Real time archive type ARCH_DEST = GRP1_RT_01 #Real time archive target instance name [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ARCH_DEST = /home/dmdba/data/DAMENG/arch ARCH_FILE_SIZE = 128 ARCH_SPACE_LIMIT = 0 ARCH_FLUSH_BUF_SIZE = 0 [ARCHIVE_ASYNC] ARCH_TYPE = ASYNC #Asynchronous archive type ARCH_DEST = GRP1_LOCAL_01 #Asynchronous archive target instance name ARCH_TIMER_NAME = RT_TIMER #Timer name, and dmtimer The names in ini are consistent
Configure dmwatcher ini
// An highlighted block [GRP1] DW_TYPE = GLOBAL #Global daemon type DW_MODE = AUTO #Automatic switching mode DW_ERROR_TIME = 10 #Remote daemon failure determination time INST_RECOVER_TIME = 60 #The interval between the main library daemon starting recovery INST_ERROR_TIME = 10 #Local instance fault determination time INST_OGUID = 453331 #Unique OGUID value of daemon INST_INI = /home/dmdba/data/DAMENG/dm.ini #dm.ini configuration file path INST_AUTO_RESTART = 1 #Turn on the auto start function of the instance INST_STARTUP_CMD = /home/dmdba/dmdbms/bin/dmserver #Command line startup RLOG_APPLY_THRESHOLD = 0 #Specifies the time threshold of the backup database replay log. It is off by default
Start standby database
// An highlighted block ./dmserver /home/dmdba/data/DAMENG/dm.ini mount
The database instance must be started in Mount mode, otherwise the rollback table space will be reconstructed during system startup,
Generate Redo logs; In addition, after startup, the application may connect to the database instance for operation and destroy the master
Data consistency of standby database. After the data daemon configuration is completed, the daemon will automatically Open the database.
Set OGUID
Start the command line tool dialsql, log in to the standby database, and set the OGUID value to 453331
// An highlighted block SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1); SQL>sp_set_oguid(453331); SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
The system determines a daemon group through OGUID value, and the user ensures the uniqueness of OGUID value, and
Ensure that the database, daemon and monitor are configured with the same OGUID value in the data daemon system.
Modify database schema
// An highlighted block SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1); SQL>alter database standby; SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
configure monitor
// An highlighted block cd /home/dmdba/data/DAMENG vi dmmonitor.ini [GRP1] DW_TYPE = GLOBAL #Global daemon type DW_MODE = AUTO #Automatic switching mode DW_ERROR_TIME = 10 #Remote daemon failure determination time INST_RECOVER_TIME = 60 #The interval between the main library daemon starting recovery INST_ERROR_TIME = 10 #Local instance fault determination time INST_OGUID = 453331 #Unique OGUID value of daemon INST_INI = /home/dmdba/data/DAMENG/dm.ini #dm.ini configuration file path INST_AUTO_RESTART = 1 #Turn on the auto start function of the instance INST_STARTUP_CMD = /home/dmdba/dmdbms/bin/dmserver #Command line startup RLOG_APPLY_THRESHOLD = 0 #Specifies the time threshold of the backup database replay log. It is off by default [dmdba@192 DAMENG]$ cat dmmonitor.ini MON_DW_CONFIRM = 1 #Confirm monitor mode MON_LOG_PATH = /home/dmdba/data/log #Monitor log file storage path MON_LOG_INTERVAL = 60 #Regularly record the system information to the log file every 60s MON_LOG_FILE_SIZE = 32 #Maximum 32M per log file MON_LOG_SPACE_LIMIT = 0 #Unlimited total log file space [GRP1] MON_INST_OGUID = 453331 #group GRP1 Unique OGUID value #The following configuration is the connection information from the monitor to the daemon of group GRP1, which is configured in the form of "IP:PORT" #IP corresponds to dmmal Mal in ini_ Host and port correspond to dmmal Mal in ini_ DW_ PORT MON_DW_IP = 192.168.78.132:52141 MON_DW_IP = 192.168.78.134:52142
Launch daemons
// An highlighted block cd /home/dmdba/dmdbms/bin ./dmwatcher /dm/data/DAMENG/dmwatcher.ini
start monitor
New window
// An highlighted block cd /home/dmdba/dmdbms/bin ./dmmonitor /dm/data/dmmonitor.ini