$more createrman_db
set echo on
spool makedb
create database rman
datafile
on next
logfile
maxdatafiles
maxinstances
maxlogfiles
character set US
national character set US
;
disconnect
spool off
exit
@/export/home/oracle/
REM ********** ALTER SYSTEM TABLESPACE *********
ALTER TABLESPACE SYSTEM
DEFAULT STORAGE ( INITIAL
EASE
ALTER TABLESPACE SYSTEM
MINIMUM EXTENT
REM ********** TABLESPACE FOR ROLLBACK **********
CREATE TABLESPACE RBS DATAFILE
ize
AUTOEXTEND ON NEXT
MINIMUM EXTENT
DEFAULT STORAGE ( INITIAL
TINCREASE
REM ********** TABLESPACE FOR TEMPORARY **********
CREATE TABLESPACE TEMP DATAFILE
size
AUTOEXTEND ON NEXT
MINIMUM EXTENT
DEFAULT STORAGE ( INITIAL
EASE
REM **** Creating four rollback segments ****************
CREATE PUBLIC ROLLBACK SEGMENT RBS_
STORAGE ( OPTIMAL
ALTER ROLLBACK SEGMENT
REM **** SYS and SYSTEM users ****************
alter user sys temporary tablespace TEMP;
alter user system temporary tablespace TEMP;
disconnect
spool off
exit
$more createrman_db
spool crdb
@/export/home/oracle/
@/export/home/oracle/
@/export/home/oracle/
connect system/manager
@/export/home/oracle/
disconnect
spool off
exit
$more createrman_db
connect internal
create tablespace rman_ts
datafile
size
create user rman_hainan identified by rman_hainan
temporary tablespace TEMP
default tablespace rman_ts quota unlimited on
rman_ts;
grant recovery_catalog_owner to rman_hainan;
grant connect
$more createrman_db
rman catalog rman_hainan/rman_hainan@rman msglog=rman
create catalog ;
exit;
rman target sys/oracle@db
connect catalog rman_hainan/rman_hainan@rman
register database;
exit;
$more rmanshell
rman rcvcat rman_hainan/rman_hainan@rman target / cmdfile /export/home/oracle/ba
ckup_level
$more backup_level
resync catalog;
run {
allocate channel t
backup
incremental level
skip inaccessible
tag hot_db_bk_level
filesperset
format
(database);
sql
backup
filesperset
format
(archivelog all delete input);
backup
format
current controlfile ;
}
$more rmanshell
rman rcvcat rman_hainan/rman_hainan@rman target / cmdfile backup_level
backup
$more backup_level
resync catalog;
run {
allocate channel t
backup
incremental level
skip inaccessible
tag hot_db_bk_level
filesperset
format
(database);
sql
backup
filesperset
format
(archivelog all delete input);
backup current controlfile;
}
$rman rcvcat rman_hainan/rman_hainan@rman target /
Recovery Manager: Release
RMAN
RMAN
RMAN> list backupset;
RMAN
List of Backup Sets
Key Recid Stamp LV Set Stamp Set Count Completion Time
根據key來刪除舊的備份
RMAN> allocate channel for maintenance type disk;
RMAN> change backupset
做完後可以看到list backupset和操作系統的文件都沒有了
(
$svrmgrl
Oracle Server Manager Release
Copyright (c)
Oracle
With the Partitioning option
JServer Release
SVRMGR> connect internal
Connected
SVRMGR> startup nomount;
ORACLE instance started
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
SVRMGR> exit
Server Manager complete
(
$rman rcvcat rman_hainan/rman_hainan@rman target /
Recovery Manager: Release
RMAN
RMAN
RMAN> run {
(
RMAN> run {
(
RMAN> run {
會把所有的日志文件恢復
(
$svrmgrl
Oracle Server Manager Release
Copyright (c)
Oracle
With the Partitioning option
JServer Release
SVRMGR> connect internal
Connected
SVRMGR> recover database using backup controlfile until cancel;
ORA
ORA
From:http://tw.wingwit.com/Article/program/Oracle/201311/17348.html