A brief look at the Oracle Hot backup users table space

Source: Internet
Author: User

Database to run in archive mode:
Archive Log List
Shutdown immediate
Startup Mount
ALTER DATABASE Archivelog;
ALTER DATABASE open;
Archive Log List

Hot Backup Users Table space:

(1) Test environment related Information view

Create a backup path

Mkdir-p/home/oracle/hotbk/

Here in order to test the path of changing the archive file

Mkdir/home/oracle/arc_orcl_dest1/alter system set log_archive_dest_1= ' location=/home/oracle/arc_orcl_dest1/'; Select Sequence#,name from v$archived_log;alter system switch logfile;alter system switch logfile;alter system switch LOGF Ile;select sequence#,name from V$archived_log;

View data files

Sql> select name from V$datafile; NAME----------------------------------------------------------------------------------------------------/u01/ app/oracle/oradata/orcl/system01.dbf/u01/app/oracle/oradata/orcl/sysaux01.dbf/u01/app/oracle/oradata/orcl/ undotbs01.dbf/u01/app/oracle/oradata/orcl/users01.dbfelapsed:00:00:00.00

View Table Spaces

Sql> select name from V$tablespace; NAME------------------------------systemsysauxundotbs1userstempelapsed:00:00:00.00

View backup Information

sql> select * from v$backup;      file# status         change# time----------  ------------------ ---------- ---------     1 not active                0      2 NOT ACTIVE                0     3 NOT ACTIVE                0     4 not active          1027726 27-sep-16elapsed: 00:00:00.00 
Sql> Select name,file# from V$datafile 2; NAME----------------------------------------------------------------------------------------------------file#- ---------/u01/app/oracle/oradata/orcl/system01.dbf 1/u01/app/oracle/oradata/orcl/sysaux01.dbf 2/u01/app/oracle/ ORADATA/ORCL/UNDOTBS01.DBF 3/u01/app/oracle/oradata/orcl/users01.dbf 4elapsed:00:00:00.00

View the number of the file number and its checkpoint

sql>  select file#,checkpoint_change# from v $datafile,      file# checkpoint_change#---------- ------------------      1          1027476      2          1027476      3          1027476     4           1027726elapsed: 00:00:00.01 
Sql> select file#,checkpoint_change# from V$datafile_header;      file# checkpoint_change#----------------------------1 1027476 2 1027476 3 1027476 4 1027726elapsed:00:00:00.01

(2) really start backup
Back up the Users table space here.

Alter TABLESPACE users begin backup;! Cp-v/u01/app/oracle/oradata/orcl/users01.dbf/home/oracle/hotbk/alter tablespace users end backup;

View Backup points

sql> select * from v$backup;      file# status         change# time----------  ------------------ ---------- ---------     1 not active                0      2 NOT ACTIVE                0     3 NOT ACTIVE                0     4 not active          1028454 27-sep-16elapsed: 00:00:00.00 

(3) Simulation data modification
Sql> Select Owner,table_name from dba_tables where tablespace_name= ' USERS ';
CREATE TABLE Scott.ob2 as SELECT * from Dba_objects;
Select COUNT (*) from SCOTT.OB2;
Commit;
ALTER system switch logfile;
View data Changes

Sql> select file#,checkpoint_change# from v$datafile;     file # checkpoint_change#---------- ------------------     1           1028188     2           1028188     3           1028188     4           1028454elapsed: 00:00:00.00sql>  select file#,checkpoint_change# from v $datafile _header;     file# checkpoint_change#---------- ------------------      1          1028188      2          1028188      3          1028188     4           1028454elapsed: 00:00:00.00

Compared with previous comparisons, it was found that Checkpoint_change had changed.


To view data blocks that have been repaired:

Sql> SELECT * from v$recover_file;no rows selectedelapsed:00:00:00.00


Corrupted analog data file

Sql>!rm-f/u01/app/oracle/oradata/orcl/users01.dbf

###### alter system flush Buffer_cache;
# # Startup Force

sql> shutdown immediate;database closed. Database dismounted. ORACLE instance shut down. Sql> Startuporacle instance started.  Total System Global area 4041949184 bytesfixed size 2259520 bytesvariable size 889193920 bytesdatabase Buffers 3137339392 Bytesredo buffers 13156352 bytesdatabase mounted. Ora-01157:cannot identify/lock data file 4-see DBWR trace fileora-01110:data file 4: '/u01/app/oracle/oradata/orcl/use RS01.DBF '

SELECT * from V$recover_file;

Sql> select * from V$recover_file; file# ONLINE online_ ERROR--------------------------------------------------------------------------------------- --change# time-------------------4 online online FILE not FOUND 0elapsed:00:00:00.01

Note: Here, no. 4th files Found


Restore: Replace lost files with backed-up files

Cp/home/oracle/hotbk/users01.dbf/u01/app/oracle/oradata/orcl/users01.dbf


Check the situation again:
Sql> select * from V$recover_file;

file# ONLINE online_ ERROR
---------- ------- ------- -----------------------------------------------------------------
change# time
---------- ---------
4 Online Online
1028454 27-sep-16
Report Error errors

Recovery: Roll forward data files using logs after backup (reproduce data modifications)

Recover DataFile 4;

sql> recover datafile 4;
Media recovery complete.
Sql> select * from V$recover_file;

No rows selected

elapsed:00:00:00.00

sql> ALTER DATABASE open;

Database altered.

elapsed:00:00:01.43
Sql> Select COUNT (*) from SCOTT.OB2;

COUNT (*)
----------
86344

elapsed:00:00:00.02

has been done here!!!!

Write well, if there is any mistake please point out, thank you!!!!

This article is from the "Liang blog" blog, make sure to keep this source http://7038006.blog.51cto.com/7028006/1856875

A brief look at the Oracle Hot backup users table space

Related Article

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.