Question 7: How to Determine the DBID and rmandbid of the database when RMAN is used
Objective: To determine the DBID of a database when RMAN is used
You can use the following methods to determine the DBID of the database:
1. If the database is enabled, you can use the following query to determine the DBID of the database.
SQL> select dbid from v $ database;
DBID
----------
269906945
2. if all data files are lost and automatic backup of control files cannot be used, but you have an available control file, you can use this old control file to mount the database, by querying in the format of 1, you try to find the DBID of the database in v $ database, because the dynamic performance view can be queried when the database is in the mount status.
3. If the control file is configured for automatic backup and is backed up locally, instead of in the Flash recovery area, the backup Set Name of the control file contains the DBID, for example:
C-269906945-20140913-07
Here:
269906945Is the DBID of the database.
If the database is 10 Gb, The Flash recovery zone + control file is used for automatic backup, and the backup set is the default directory. You do not need to set the DBID, you can use the following command to restore the control file or parameter file spfie from the automatic backup set:
RMAN> startup nomount;
RMAN> restore controlfile from autobackup.
4. If you have previously performed rman backup and the details of the backup process are recorded, or there are backup logs, it is easy to find the DBID of the database, such:
$ Rman target/
Recovery Manager: Release 10.2.0.4.0-Production on Sat Sep 13 12:53:56 2014
Copyright (c) 1982,200 7, Oracle. All rights reserved.
Connected to target database: RADIUS(DBID = 269906945)
RMAN> backup database format'/u01/backup/backup_full/full _ % d _ % T _ % s _ % p. bak ';
Starting backup at 13-SEP-14
Using target database control file instead ofrecovery catalog
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: sid = 139 devtype = DISK
Channel ORA_DISK_1: starting full datafilebackupset
Channel ORA_DISK_1: specifying datafile (s) inbackupset
Input datafile fno = 00001 name =/u01/oradata/radius/system01.dbf
Input datafile fno = 00003 name =/u01/oradata/radius/sysaux01.dbf
Input datafile fno = 00005 name =/u01/oradata/radius/example01.dbf
Input datafile fno = 00002 name =/u01/oradata/radius/undotbs01.dbf
Input datafile fno = 00004 name =/u01/oradata/radius/users01.dbf
Channel ORA_DISK_1: starting piece 1 at13-SEP-14
Channel ORA_DISK_1: finished piece 1 at13-SEP-14
Piecehandle =/u01/backup/backup_full/full_RADIUS_20140913_50_1.baktag = TAG20140913T125428 comment = NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55
Finished backup at 13-SEP-14
Starting Control File and SPFILE Autobackupat 13-SEP-14
Piece handle =/tmp/c-269906945-20140913-08comment = NONE
Finished Control File and SPFILE Autobackupat 13-SEP-14
/*************************************** *********************/
[Description]
When RMAN is backed up, logs must be generated to understand the entire backup progress and record a lot of information used in future recovery. Such as: Backup set name, path, archive sequence number, dbid, etc.
5. If you are using a UNIX system, if there is a problem with the database, but there is still a data file, you can view it using the strings command, as shown below:
$ Strings undotbs01.dbf | grep MAXVALUE
3587267724, MAXVALUE
... Etc.
From the above we can see that DBID is 3587267724
6. If the Restore directory catalog is used, connect to the Restore directory database through RMAN and run the list incarnation command to query the DBID.
First, you must place the target database in the nomount state, and then query the DBID
For example:
D: \> rman target <user>/<pwd> @ mydb rcvcat <user>/<pwd> @ rcat
RecoveryManager: Release 8.1.7.4.1-Production
RMAN-06193: connected to target database (not started)
RMAN-06008: connected to recovery catalog database
RMAN> startup nomount
RMAN-06196: Oracle instance started.
TotalSystem Global Area 94980124 bytes
FixedSize 75804 bytes
VariableSize 57585664 bytes
DatabaseBuffers 37240832 bytes
RedoBuffers 77824 bytes
RMAN> list incarnation;
RMAN-03022: compiling command: list
Listof Database Incarnations
DBKey Inc Key DB Name db id cur Reset SCN Reset Time
-----------------------------------------------------------
12 ORCL817 1411146558 YES 282854 03-DEC-02
-----------------------------------------------------------------
-- END --
What does DBID in the database mean?
DBID is often used in oracle recovery. What is the role of DBID? Does it have a one-to-one correspondence with db_name?
DBID is often used in oracle recovery. What is the role of DBID? Does it have a one-to-one correspondence with db_name?
Is DBID used to identify the serial number of db_name? Please explain it!
1 DBID is used for automatic data recovery when the control file is lost.
RMAN> restore controlfile from autobackup;
Start restore from month 15-2 to month 08
Use channel ORA_DISK_1
RMAN-00571: ========================================================== ==============================
RMAN-00569: ==================== error message stack follows ==========================
RMAN-00571: ========================================================== ==============================
RMAN-03002: failure of restore command at 02/15/2008 00:43:38
RMAN-06495: must explicitly specify DBID with set dbid command
2 DBID is sometimes used for rman recovery.
3 oracle automatic control file also uses DBID as the file name
4 DBID exists in the data file and Control File
Next, let's take a look at Oracle HowTo in eygle: how to obtain the DBID of a database.
Www.eygle.com/..d.html
In the process of database recovery, we often need to know the DBID of the Oracle database. There are usually the following methods to obtain the DBID of the database.
1. query v $ database to obtain
Because DBID has records in the control file and data file, you can query the v $ database view if you can mount the database.
SQL> alter database mount; Database altered. SQL> select dbid from v $ database; DBID
----------
3152029224SQL> 2. In nomount status
If the database is configured with the automatic control file backup (Oracle9i) with the default name, we can get the DBID from the automatic backup file.
[Oracle @ jumper dbs] $ cd $ ORACLE_HOME/dbs
[Oracle @ jumper dbs] $ ll c -*
-Rw-r ----- 1 oracle dba 3375104 Dec 21 c-3152029224-20051221-00
-Rw-r ----- 1 oracle dba 3358720 Jan 21 c-3152029224-20060121-00
-Rw-r ----- 1 oracle dba 3358720 Jan 21 c-3152029224-20060121-01 here 3152 ...... remaining full text>
How does the oracle database back up during implementation? Is it imp/exp or rman backup? I have read the rman backup method, which is troublesome.
.... It's easy to back up rman!
EXP/IMP can also be used for small databases. For large databases, it won't work!
Use EXDP/IMDP! Logical backup is just a supplement to physical backup!
Rman is strongly recommended.
Here is a full-Backup RMAN script:
Connect target username/password @ service;
Crosscheck archivelog all;
Crosscheck backup;
Delete noprompt expired archivelog all;
Delete noprompt obsolete;
Delete expired copy;
Delete noprompt expired backup;
Run {
Backup as compressed backupset database format's: \ rmanbak \ full _ % d _ % T _ % t _ % S 'tag = 'fullbak ';
Backup archivelog all delete all input skip inaccessible format's: \ rmandatabse \ rmanbak \ ARC _ % U ';
Backup current controlfile format's: \ rmandatabse \ rmanbak \ control \ control_bak _ % T ';
}
Then make a batch:
Rman merge fileinto 'full_rman.txt 'msglog = 'd:/rman/rmanbat/full_rmanlog % date :~ 4,10%. Log'
Finally, it's easy to schedule a task in windows!
I still have the Incremental backup script here, so I will not post it! Learn by yourself!