oracle之用户管理备份

联系:手机(+86 13429648788) QQ(107644445)QQ咨询惜分飞

标题:oracle之用户管理备份

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、冷备份
1、shutdown immedate
2、copy datafile/redofile/contorfile/spfile(pfile)/pwdfile
3、startup

--备份脚本(没备份spfile/pwdfile等文件)
sqlplus / as sysdba
set feedback off heading off verify off trimspool off
set pagesize 0 linesize 200
define dir='c:\user'
define ws='c:\user\user.sql'
spool &ws
select 'host copy '||name|| ' &dir' from v$datafile order by 1;
select 'host copy '||name|| ' &dir' from v$controlfile order by 1;
select 'host copy '||name|| ' &dir' from v$tempfile order by 1;
select 'host copy '||member|| ' &dir' from v$logfile order by 1;
select 'host copy '||value' &dir' from v$parameter where name like '%spfile%';--backup spfile
spool off
shutdown immediate
@&ws
startup

二、热备份
1)备份表空间
alter tablespace tabalepsacename begin backup;
copy
alter tablespace tabalepsacename endbackup;
2)备份整个数据库
alter database begin backup;
copy
alter database end backup;

--脚本备份表空间
set feedback off heading off verify off trimspool off
set pagesize 0 linesize 200
define dir='c:\user'
define ws='c:\user\user.sql'
define ts=&tablespace
alter tablespace &ts begin backup;
spool &ws
select 'host copy '|| file_name || ' &dir' from dba_data_files where tablespace_name =UPPER('&ts');
spool off
@&ws
alter tablespace &ts end backup;
--脚本备份整个数据库
set feedback off heading off verify off trimspool off
set pagesize 0 linesize 200
define dir='c:\user'
define ws='c:\user\user.sql'
alter database begin backup;
spool &ws
select 'host copy '||name|| ' &dir' from v$datafile order by 1;
select 'host copy '||name|| ' &dir' from v$controlfile order by 1;
select 'host copy '||name|| ' &dir' from v$tempfile order by 1;
select 'host copy '||member|| ' &dir' from v$logfile order by 1;
select 'host copy '||value' &dir' from v$parameter where name like '%spfile%';--backup spfile
spool off
@&ws
alter database end backup; 

3)备份数据文件
alter datafile 4 begin backup;
copy
alter datafile 4 end backup;

三、查看backup状态
select * from v$backup;

此条目发表在 Oracle备份恢复 分类目录。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>