Oracle backup and recovery Series
Tutorial Environment Introduction:
Create a test user snow. The user has a table and a stored procedure. A task takes effect easily by simulating a user inserting a timestamp every minute like a database to generate database behavior. During the backup and recovery process, the timestamp can be used to check whether the recovery operation is successful.
-------------------------------------- Recommended reading --------------------------------------
RMAN: Configure an archive log deletion policy
Basic Oracle tutorial-copying a database through RMAN
Reference for RMAN backup policy formulation
RMAN backup learning notes
Oracle Database Backup encryption RMAN Encryption
-------------------------------------- Split line --------------------------------------
View database names and archive Modes
SYS @ PRACTICE> col name for a10
SYS @ PRACTICE> col log_mode for a10
SYS @ PRACTICE> select name, log_mode from v $ database;
NAME LOG_MODE
--------------------
PRACTICE ARCHIVELOG
View database version
SYS @ PRACTICE> select * from v $ version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production
Data Files
SYS @ PRACTICE> col name for a40
SYS @ PRACTICE> select name, bytes/1024/1024 MB from v $ datafile;
NAME MB
--------------------------------------------------
/Oradata/PRACTICE/system01.dbf 710
/Oradata/PRACTICE/sysaux01.dbf 570
/Oradata/PRACTICE/undotbs01.dbf 110
/Oradata/PRACTICE/users01.dbf 5
/Oradata/PRACTICE/example01.dbf 313.125
/Oradata/PRACTICE/tools01.dbf 20
/Oradata/PRACTICE/indx. dbf 20
The following statement can also display the same data
Select file_name, bytes/1024/1024 MB from dba_data_files;
View the location and size of online redo logs
SYS @ PRACTICE> select member, bytes/1024/1024 MB from v $ logfile lf, v $ log l where lf. group # = l. group #;
MEMBER MB
----------------------------------------------------------------------
/Oradata/PRACTICE/redo03.log 50
/Oradata/PRACTICE/redo02.log 50
/Oradata/PRACTICE/redo01.log 50
View the location of the Control File
SYS @ PRACTICE> col name for a100
SYS @ PRACTICE> select name from v $ controlfile;
NAME
--------------------------------------------------------------------------------
/Oradata/PRACTICE/control01.ctl
/U01/app/oracle/fast_recovery_area/PRACTICE/control02.ctl
View the location and size of the temporary file
SYS @ PRACTICE> select name, bytes/1024/1024 MB from v $ tempfile;
NAME MB
--------------------------------------------------
/Oradata/PRACTICE/temp01.dbf 29
Create test user SNOW
Grant connect, RESOURCE, unlimited tablespace to snow identified by snow;
Alter user snow default tablespace tools;
Alter user snow temporary tablespace temp;
Create a timestamp table
CONNECT snow/snow
Drop table date_log;
Create table date_log (
Create_time date constraint create_date_pk primary key using index tablespace indx,
Name varchar2 (10)
);
Col segment_name for a15
Col TABLESPACE_NAME for a15
Select segment_name, tablespace_name from user_segments;
SEGMENT_NAME TABLESPACE_NAME
------------------------------
DATE_LOG TOOLS
CREATE_DATE_PK INDX
Create a stored procedure based on a timestamp table
Conn snow/snow
Create or replace procedure create_date_log_row
IS
BEGIN
Insert into date_log VALUES (SYSDATE ,'--');
END;
/
Create a job to execute the stored procedure to simulate the database in "running"
Run once per minute
Conn snow/snow
VARIABLE jobno number;
BEGIN
-- Run the job every 1 minutes
DBMS_JOB.SUBMIT (: jobno, 'snow. create_date_log_row; ', SYSDATE,' (SYSDATE + 1/(24*60 ))');
Commit;
END;
/
SNOW @ PRACTICE> print jobno
JOBNO
----------
24
SNOW @ PRACTICE> col what for a30
SNOW @ PRACTICE> SELECT job, what FROM USER_JOBS;
JOB WHAT
----------------------------------------
24 snow. create_date_log_row;
For more details, please continue to read the highlights on the next page:
For more details, please continue to read the highlights on the next page:
[Content navigation] |
Page 1st: experiment environment Introduction |
Page 2nd: consistent backup for downtime |