The following is my ontape-r summary. I just share my experience (because I have seen this post in the Forum, but it is not very detailed)
The whole process is only completed in a unique environment that I can access. If you have any mistakes, please let us know...
It consists of six parts:
1. Prerequisites for recovery 2. Detailed recovery process 3. Monitoring during recovery
4. The online. log of the entire process is restored successfully.
5. Problems I encountered during the recovery process
6. Commonly Used commands
I. Prerequisites for restoration (the recovery process can be summarized as follows :)
When I use the ontape backup to recover data to another server, the environment is as follows:
1. The two server models are the same as those of the e-hpc series)
2. The same operating system (HP-UX B .11.00), database version (ids7.31.fc6 ),
3. The quantity and size of non-temporary dbspace disk space must be consistent (that is, the chunk size of each dbspace is the same, and the corresponding symbol is connected
The location of the directory should be the same)
4. onconfig configuration file (finally proposed! It does not need to be exactly the same !!!)
As far as the recovered machine is concerned, although it is an HP minicomputer and the production machine that backs up 0 levels, the number of CPUs, memory, and hard disks
Because the parameters of onconfig, such as nettype and numcpuvps, are different, but I have ensured that the following parameters are consistent in onconfig:
Rootname
Rootpath
Rootoffset
Rootsize
Mirror
Export path
Mirroroffset
Tapedev
Tapeblk
Tapesize
Ltapedev
Ltapeblk
Ltapesize
Logsmax
Everything else has not changed. Anyway, I have succeeded in doing so ...)
Notes:
In the recovery process, if the Recovery fails, the oninit database on the recovery machine may not be able to start, so you have to use oninit-I for initialization --(((,
I have not found a good method...
--------------------------------------------------------------------------------
---------------------------------------------------------------------------------
Ii. Detailed recovery process: (only perform level 0 restoration)
1. Switch to Informix user (this step is selected based on the actual situation)
PS-Ef | grep iSQL. If this process exists, kill it.
2. Use IPCS to check whether there is any shared memory occupied by other database users.
After confirming the above (if the above shared memory still exists, "shared memory initialization failed" may be reported during the ontape-r process, leading to recovery failure !!!)
3. Drop the database in onmode-ky
Hp9000:/Informix/etc> ontape-R
Please mount Tape 1 on/dev/RMT/0 m and press return to continue...
Archive tape Information
Tape type: Archive Backup Tape
Online version: Informix Dynamic Server version 7.31.fc6
Archive Date: Wed Dec 3 16:50:54 2003
User ID: HCB
Terminal ID:/dev/pts/10
Archive level: 0
Tape device:/dev/RMT/0 m
Tape blocksize (in K): 4096
Tape size (in K): 25165824
Tape number in series: 1
...............
The backup disk configuration is shown here (you can verify whether the correct device and connection are generated ). Including dbspace and Chunk. Omitted...
1. Continue restore? (Y/n) y
2. Do you want to back up the logs? (Y/n) N
------------------------------------ Enter the fastrecovery status (onstat-observation)
/* The restoration starts at this time. The Restoration takes a long time and the percentage is not displayed. Please wait */
3. Restore a level 1 Archive (y/n) N
--------------------------------------- The answer in this step is N, and level 1 recovery is not required.
4. Do you want to restore log tapes? (Y/n) N
---------------------------------------- This step should be answered as N, no log recovery is required
Program over./* Recovery completed */
/Home/Informix/bin/onmode-sy/* The database automatically enters the quiescent mode */
/* A fast recovery mode exists during this period until it enters the quiescent mode. Onstat-And onstat-D can be used to monitor databases. */
5. If onstat-shows that the quiescent mode is enabled, run the following command manually:
Onmode-M/* make the database online */
6. Complete. (The whole process is 3 hours, 20 minutes, 24 GB tape)
Bytes --------------------------------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~
Iii. Monitoring during recovery
During the restoration of dbspace, because online. log is not updated (I do not know why, is there a problem? Tail-F Online. log does not change ),
So I used onstat to analyze the recovery status.
Hp9000:/Informix> onstat-D (Basic dbspace conditions can be observed)
Informix Dynamic Server version 7.31.fc6 -- fast recovery (ckpt req) -- up 00:59:30 -- 316616 Kbytes
Blocked: ckpt
Hp9000:/Informix> onstat-U (view tape read/write speed)
Informix Dynamic Server version 7.31.fc6 -- fast recovery (ckpt req) -- up 01:30:48 -- 316616 Kbytes
Blocked: ckpt
Userthreads
Address flags sessid user tty wait tout locks nreads nwrites
Cda-00011053028 --- P--D 1 Informix-0 0 11 3
C0000000110536f0 --- P--F 0 Informix-0 0 0 0
C000000011053db8 --- P--F 0 Informix-0 0 0 0
C000000011054133 --- P--F 0 Informix-0 0 0 0
C000000011054b48 Y--P--M 13 Informix to c0000000114898e0 0 0 0
C000000011055210 --- P --- 14 Informix-0 0 0 0
C0000000110558d8 --- P--B 15 Informix-0 0 0 0
C000000011055fa0 --- P--D 16 Informix-0 0 0 0
C000000011056668 ----- R-13 Informix to 0 0 0 5 4543006
9 Active, 128 total, 9 maximum concurrent
5046814
5857822
6066718 mon Dec 15 22:21:56 eat 2003
6498846 mon Dec 15 22:30:15 eat 2003
7029278 mon Dec 15 22:40:37 eat 2003
8221214 mon Dec 15 23:02:08 eat 2003
10506782 mon Dec 15 23:44:14 eat 2003
It mainly depends on the data changes in the nwrites column, which should increase by time...
Hp9000:/Informix> Sar-D 2 20
View the read/write status of a disk, such as c0t9d0, which is a logical volume consisting of a hard disk)
To monitor whether the recovery is normal...
Bytes --------------------------------------------------------------------------------------------------------
4. Restore the online. log of the entire process
Bytes -----------------------------------------------------------------------------------------------------------------------------
20:22:54 dynamically allocated new virtual shared memory segment (size 8192kb)
20:22:54 dynamically allocated new virtual shared memory segment (size 8192kb)
20:22:54 physical restore of rootdbs, hcbdbs, logdbs started.
20:23:03 checkpoint completed: duration was 0 seconds.
/* No logs are generated when dbspace is restored !? */
23:49:40 checkpoint completed: duration was 0 seconds.
23:49:41 checkpoint completed: duration was 0 seconds.
23:49:41 physical restore of rootdbs, hcbdbs, logdbs completed.
23:49:41 checkpoint completed: duration was 0 seconds.
23:52:13 physical recovery started.
23:52:13 physical recovery complete: 0 pages restored.
At 23:52:13 logical recovery started.
23:52:16 logical recovery complete.
0 committed, 0 rolled back, 0 open, 0 bad locks
23:52:16 bringing system to quiescent mode with no logical restore.
23:52:17 quiescent Mode
23:52:17 checkpoint completed: duration was 0 seconds.
23:53:22 On-Line Mode
23:53:22 affinitied VP 3 to phys proc 1
23:53:22 affinitied VP 1 to phys proc 0
23:57:26 checkpoint completed: duration was 1 seconds.
Bytes ------------------------------------------------------------------------------------------------------------------------
Bytes ----------------------------------------------------------------------------------------------------------------------
5. Problems I encountered during the recovery process:
0. Recovery failed. The error message "Shared Memory initial statement failed" appears in online. log"
Although the database may have been deprecated before recovery, the shared memory still has some uncleared items. Check IPCS and then kill it.
1. The system prompts that the original dbspace and chunk are inconsistent with those on the Recovery Machine,
Create a bare device and symbolic connection for the Chunk Based on the dbspace attached to the backup.
2. The following error occurs during recovery:
Continue restore? (Y/n) y
Do you want to back up the logs? (Y/n) N
Unable to open input file's'
Unable to open input file 'C'
Physical restore failed-buc_fe.c: Archive API processing failed at line 703 for msgtype
Program over.
Processing:
Check the permissions and properties of the connection and directory of the bare device files and symbols of dbspace to ensure they are correct !!!
If no problem exists,
Do the following commands as root:
# Vi/etc/privgroup and add the following line
Informix mlock
# Getprivgrp
Global privileges: chown
# Setprivgrp-F/etc/privgroup
# Getprivgrp
Global privileges: chown
Informix: mlock
And then restore...
Bytes ----------------------------------------------------------------------------------------------------------
6. Commonly Used commands
Oninit
Oninit-Iy (initialize the database and delete all dbspace and Chunk)
Oninit-s (offline --> static)
Onmode-ky offline
Onmode-s graceful shutdown --> quiescent (online to static, let the user finish processing)
Onmode-u immediate shutdown --> quiescent (online to static, all users terminate immediately)
Onmode-M quiescent ---> online
Onstat-view Server Status
Onstat-d view dbspace and chunk
Onstat-l view logical logs
IPCS view shared memory
Ipcrm deletes a shared memory
Ipcrm-m id
Ipcrm-s ID
Operations on logical logs
Log On As an Informix user,
$ Onmode-uy (switch from online to quiescent, and all users stop immediately)
Onmode-M (switch to online)
$ Onparams-a-d logdbs-s 100000 (add logical logs to logdbs)
Logdbs is the dbspaces name, and-s 100000 indicates that the space is increased by MB.
Execute the preceding command four times in a row, so that the new logical log space is 500 mb in total.
Onstat-L to view logical logs, delete the first three old logical logs,
Make a level 0 backup before deletion
# Ontape-S-l 0
Execute this command for level 0 backup. We recommend that you end your work in the business system every day if you allow
Perform a level-0 backup. After the backup is completed, manage the backup tape and mark it.
$ Onparams-D-l logid
Logid is the ID of the logical log. You can use onstat-L to view the ID, and then delete it according to the ID.
Except 3 old logic logs.
1. Add a new dbspace: (datadbs, 15 m, offset is 0)
Onspaces-c-d datadbs-P/home/Informix/datadbs-o 0-s 15000
2. Add a chunk in the dbspace datadbs: (datadbs_chunk1)
Onspaces-A datadbs-P/home/Informix/datadbs_chunk1-o 0-s 15000
3. Delete the chunk
Onspaces-D datadbs-P/home/Informix/datadbs_chunk1-o 0
4. Delete dbspace (only when the dbspace to be deleted has no data)
Onspace-D datadbs
Export Database:
Use the dbexport tool to unload data into text and load it to other servers.
(1) To uninstall the text, follow these steps:
Register with Informix users
Dbexport cleardb-O workdir-SS
When the system prompts dbexport completed! Data has been detached.
Where:
-SS ensures that the database creation information or table creation information is retained, such as the log mode, initial extent size, lock mode, and dbspace of the table.
-O: Specifies the directory where the unmounted data is stored. The data is stored in the cleardb. Exp Directory, which contains cleardb. SQL and files such as *. unl,
The prompt information is stored in the dbexport. Out file.
(2) The steps for loading text are as follows:
Use Informix user registration to ensure that the database is in the on_line status, and there is no database with the same name on the server.
Dbimport cleardb-I workdir
When the system dbimport completed! The system prompts that the data has been loaded.
Where:
-I specifies where to load.
How can I detach a database to a tape device and load it on another server without damaging the database information (such as row-level locks?
1) The uninstall procedure is as follows:
Register with a DBA user
Insert the tape for storing data into the tape drive to ensure that the tape and tape drive are available in good condition.
Dbexport cleardb-T/dev/RMT/0 m-B 512 K-s 2048000 K-SS
When the system prompts dbexport completed! Data has been detached.
Where:
-SS ensures that the database creation information or table creation information is retained, such as the log mode, initial extent size, lockmode, and dbspace of the table
-T tape device/dev/RMT/0 m
-S tape capacity 2 GB
-Block B Size: KB
The prompt information is stored in the dbexport. Out file.
2) the loading steps are as follows:
Register with a DBA user
Place the tape that stores the detached data on the tape drive. confirm that the tape drive is normal and that the database system is in the on_line status. The server does not have a database with the same name.
$ Dbimport cleardb-T/dev/RMT/0 m-B 512 K-s 2048000 K
When the system dbimport completed prompts that the data has been loaded! The prompt information is stored in the dbimport. Out file.