Oracle-full recovery of user management (IV)

Source: Internet
Author: User

Oracle-full recovery of user management (iv) I. the role of resetlogs 1. reset the current log serial number to 1, discard all previous log information, you can delete them on the operating system; 2. in non-archive mode, if online redo logs are lost, you can create it 3. update the information in the control file. 4. update all current data files, redo log files online, and archive log files with the new SCN number. Therefore, you must use resetlogs to open the database if you use backup control files or do not completely recover the database. In the archive file name format, there is a parameter % r, which indicates the incarnation number. II. after the data location in the database is commit, the data will be placed in the online redo log; if a checkpoint occurs, the data will be placed in the data file; If archiving is triggered, the data is stored in the archive log. The experiment below proves that the above conclusion is,

1. create tables and insert data. SQL> create table t3 (id int, name char (10) tablespace app1; Table created. SQL> insert into t3 values (0, 'apple'); 1 row created.2. view the current online redo log file SQL> select group #, members, status from v $ log; GROUP # members status ---------- ---------------- 1 1 CURRENT 2 1 INACTIVE 3 1 ACTIVE

 

You can see that the current online redo log file is number 1, and then you can view the view v $ logfile to see which is number 1.
SQL> select * from v$logfile;    GROUP# STATUS  TYPE    MEMBER                              IS_---------- ------- ------- ----------------------------------- ---         1         ONLINE  /u01/oradata/wilson/redo01.log      NO         3         ONLINE  /u01/oradata/wilson/redo03.log      NO         2         ONLINE  /u01/oradata/wilson/redo02.log      NO

 

3. Check the online redo file because it has not been submitted. Check redo01.log,
[Oracle @ oracle11g wilson] $ strings redo01.log | grep apple cannot see the data, and then submit the data. You can see [oracle @ oracle11g wilson] $ strings redo01.log | grep appleapple

 

With the inserted data. 4. View data files
[Oracle @ oracle11g wilson] $ strings app1_01.dbf | grep apple's dirty data in the memory has no results before it is written to the data file. A check point is triggered manually. SQL> alter system checkpoint; system altered. view the data file again. [oracle @ oracle11g wilson] $ strings app1_01.dbf | grep appleapple,

 

You can view the data. 5. View archived log files
Because online redo log files have not been archived, all manually archived logs are SQL> alter system archive log current; System altered. view the newly archived log file [oracle @ oracle11g arch] $ strings sun_00000000000004_0000956547.arc | grep appleapple

 

We can see that there is data, so we can clearly know where the data in each step will be. III. restoration of read-only tablespace 1. if it is a read-only tablespace, it can be restored directly if it is damaged; 2. during the backup, The tablespace is read-only, and then changed to readable and writable. If the tablespace is damaged, it can be restored and restored. 3. during the backup, The tablespace is readable and writable, and then changed to the read-only tablespace. If the tablespace is damaged, it can be restored and restored. Note that the read-only tablespace will affect the control file. When the reconstructed control file is used, when using the backup control file (excluding the information of the read-only tablespace) or renaming the data file, run the alter database rename' command '...... 'to '........ '; to modify the control file. The following uses the backup control file script to check whether there are read-only tablespaces.
Backup control file, SQL> alter database backup controlfile to trace as '/tmp/t1. SQL'; Database altered. change the table space in app2 to a read-only table space. SQL> alter tablespace app2 read only; Tablespace altered. back up the control file, SQL> alter database backup controlfile to trace as '/tmp/t2. SQL'; Database altered.

 

Backup is the script for creating control files, compared to the backup of control files in read-only tablespaces.
[oracle@oracle11g tmp]$ diff t1.sql t2.sql 70d69<   '/u01/oradata/wilson/app2_01.dbf',98a98,103> -- Files in read-only tablespaces are now named.> ALTER DATABASE RENAME FILE 'MISSING00006'>   TO '/u01/oradata/wilson/app2_01.dbf';> > -- Online the files in read-only tablespaces.> ALTER TABLESPACE "APP2" ONLINE;140d144<   '/u01/oradata/wilson/app2_01.dbf',165a170,175> -- Files in read-only tablespaces are now named.> ALTER DATABASE RENAME FILE 'MISSING00006'>   TO '/u01/oradata/wilson/app2_01.dbf';> > -- Online the files in read-only tablespaces.> ALTER TABLESPACE "APP2" ONLINE;

 

You can see the differences in the control file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.