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

How to understand the catalog command

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

Share

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

This article introduces you how to understand the catalog command, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Use catalog to enter RMAN, with the following command

[oracle@host ~] $rman targetsys/sys@testcatalogrman/rman@cat

Let's list first.

RMAN > list backup

New incarnation of database registered in recovery catalog

Starting full resync of recovery catalog

Full resync complete

RMAN will use control files to automatically resynchronize the recovery information of the database to ensure the most effective catalog

You can also manually resynchronize information under RMAN.

RMAN > RESYNC CATALOG; # full synchronization

Sometimes, we may use non-RMAN tools to back up database files

For example, a users tablespace backup is performed with a system copy

SQL > ALTER TABLESPACE users BEGIN BACKUP

(use the system copy command to copy the data file corresponding to the users tablespace elsewhere)

SQL > ALTER TABLESPACE users END BACKUP

At this time, no relevant information was recorded in RMAN's catalog.

We can add backup information for catalog with the following command

RMAN > CATALOG DATAFILECOPY'/ home/oracle/dumptest/users01.dbf'

Cataloged datafile copy

Datafile copy filename=/home/oracle/dumptest/users01.dbf...

At this point, you can use the list copy command of RMAN to view the copy information you just added.

Similarly, the catalog command can also add other backup information

Add multiple backup slice information

RMAN > CATALOG BACKUPPIECE'/ 09dtq55dong1','/ 0bdtqdoubling 1room1'

You can also add all the relevant file information in a directory that has not been recorded by RMAN

RMAN > CATALOG START WITH'/ home/oracle/oradata/test/'

If an unrecorded file is found, it will be prompted

Searching for all files that match the pattern / home/oracle/oradata/test/

List of Files Unknown to the Database

Do you really want to catalog the above files (enter YES or NO)?

If there are any documents that do not match, an error will be reported.

RMAN-07517: Reason: The file header is corrupted

Now that the information is added, there is a command to delete the information.

If the backup information that already exists in catalog is invalid (file does not exist or is corrupted, etc.)

We can use the CHANGE UNCATALOG command to clear the relevant information

Try it, first make a copy of datafile 4 (users01)

RMAN > backup as copy datafile 4

Rman > backup as copy database format'/ oradata/backup_%u.BAK'

RMAN > list datafilecopy all

At this time, you can also see the relevant information (the corresponding key is 647). Execute the following command

Delete this copy file with the system command at this time

RMAN > change datafilecopy 647 uncatalog

List again, the copy information of the copy with key 647 has been cleared

Here, I want to briefly talk about some views related to backup information.

If catalog is used, the information is stored in the relevant views of catalog and target, respectively.

The view in catalog starts with RC_, and the view in target starts with V$.

Because there are quite a few views involved (dozens of them), each view also has many fields.

Say what you need, let's start with the copy of the data file just now.

Under catalog is RC_DATAFILE_COPY, briefly speaking a few fields.

DB_KEY, distinguishing the database primary key used by target

DBINC_KEY, database avatar (incarnation) primary key

DB_NAME, database name

CDF_KEY, the primary key of the copy of the data file

RECID and STAMP, derived from the V$DATAFILE_COPY of target, are unique in the target control file

NAME, file name, including path

TAG, the tag name of the copy

FILE#, data file absolute file number

BLOCKS, the number of blocks for copies of the data file

BLOCK_SIZE, block size, which can be used to calculate the replica size of data files using blocks and block_size

COMPLETION_TIME, copy creation completion time

STATUS, copy status, including

An available (available), U unavailable (unavailable), X expired (expired), D deleted (deleted)

Under target is V$DATAFILE_COPY, and the information comes from the control file.

Under catalog is RC_DATAFILE_COPY, briefly speaking a few fields.

Does not include DB_KEY,DBINC_KEY,DB_NAME,CDF_KEY

There are other major fields.

Simply record a few more commands

List backup information that contains archive logs

RMAN > list backup of archivelog all

The of parameter can be used to limit the type of view

For example, list backup of datafile 1

Is to enumerate the backup containing data file No. 1 (usually system data file)

Restore restore archived logs according to SCN number

RMAN > restore archivelog from scn 898815 until scn 902871

Just now I mentioned a new term INCARNATION, which is temporarily translated into avatar in Chinese (may not be appropriate)

After the database resetlogs, it will be a new start, and the previous backup will no longer be useful.

After resetlogs, a new incarnation is also generated, and the database has related views to record incarnation history information.

The database log sequence number will also be reset to 1 and a new SCN will be assigned

Under the current avatar, a new avatar is generated by executing resetlogs. The current avatar is called the parent avatar (parent incarnation).

Father incarnation and father incarnation, becoming the ancestor incarnations of the current incarnation.

From an ancestral incarnation, two new avatars are generated, and each becomes a sibling incarnation (sibling incarnations).

If each avatar has its own backup, it cannot be recovered from each other, which is called Orphaned Backups.

Avatars are very useful in some complex recovery situations. Get to know them briefly today and apply them later.

View database incarnation command

RMAN > LIST INCARNATION

The results are as follows

List of Database Incarnations

DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time

-

1 8 TEST 1969292173 PARENT 1 30-JUN-05

(middle slightly)

1 69 TEST 1969292173 CURRENT 903961 18-JAN-09

If more than one target is registered in the catalog, you can use the database parameter to distinguish

RMAN > LIST INCARNATION OF DATABASE 'TEST'

One more backup for copy

RMAN > backup as copy copy of database from tag='TAG20120310T095833' format'/ oradata/ora10/backup_%f.bk'

On how to understand the catalog command to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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

Servers

Wechat

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

12
Report