backup.txt

来自「Oracle培训专题3-数据库配置.ppt Oracle培训专题4-备份和恢复」· 文本 代码 · 共 85 行

TXT
85
字号
--准备
sql>conn zht/zht

select count(*) from user_tables;

SQL> select username,default_tablespace from user_users;
SQL> create tablespace ZHTTBS datafile '%ORACLE_BASE%\oraData\My9iDB\ZhtTBS1.dbf
' size 50M;
SQL> alter user zht default tablespace "ZHTTBS";

create table table1(c1 numeric(10,2));

insert into t1 values(1);
insert into t1 values(2);

select * from table1;

--冷备
select name from v$datafile;
select name from v$tempfile;
select member form v$logfile;
select name from v$controlfile;

SQL>shutdown immediate

!copy file1 to file2
copy *.* d:\Oracle\OraData\ColdBackup\;

SQL>startup 

SQL> select group#,sequence#,status,first_change# from v$log;


declare 
  -- Local variables here
  i integer;
begin
  -- Test statements here
  for i in 1..1000
    loop
      insert into table1 values(i);
    end loop;
  
end;

--热备
SQL> select group#,sequence#,status,first_change# from v$log;
 truncate table table1;
select * from table1;

alter tablespace zhttbs begin backup;

select a.file#,b.name,a.status from v$backup a,v$datafile b
where a.file#=b.file#;

insert into table1 values(1);

copy

insert into table1 values(2);

alter tablespace zhttbs end backup;


insert into table1 values(3);

select group#,sequence#,status,first_change# from v$log;

select * from table1;

select a.file#,b.name,a.status from v$backup a,v$datafile b
where a.file#=b.file#;

alter system archive log current;


--备份控制文件

show parameter user_dump_dest;

alter database backup controlfile to trace;



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?