oracle 自动备份、恢复功能
来源:互联网 发布:ubuntu系统怎么重装 编辑:程序博客网 时间:2024/05/17 02:40
1.自动备份可以采用exp方式(前提是你要有导出的权限),并写一个操作系统的脚本,如果windows系统,可写一个bat,在其中使用exp进行导出,然后将BAT添加计划任务。
backup.bat --代码如下:
echo offexp system/sa@orcl file=d:\autobackup\ies%date%.dmp log=d:\autobackup\ies%date%_exp.log owner=(ies) buffer=655000 compress=ypause
2.自动恢复备份是定期做,恢复一般只有当需要恢复时才发生,所以恢复是不添加到计划任务中的,但是为了操作方便,也可以做成.bat文件。恢复时一般要做两件事情:
2.1、启动sqlplus,创建表空间和用户,并推出sqlplus;
2.2、导入备份的.dmp文件。
recover.bat--代码如下:
sqlplusw system/oracle@oracle @sqlplus_cuser.sqlecho offimp system/oracle@oracle fromuser=(ies) touser=(ies) buffer=655000 ignore=y commit=y file=d:\autorecover\ies2010-11-23.dmp log=d:\autorecover\ies2010-11-23_imp.logpause
注意:
1.需要用户手工做的操作时将备份的×××.dmp文件放在指定目录(d:\autorecover)下,并将文件名改为ies2010-11-23.dmp(或者可以不改文件名,而是将recover.bat用记事本打开,将ies2010-11-23.dmp改为对应的文件名)
2.sqlplus_cuser.sql是创建表空间和用户的功能。--代码如下:
spool cuser.logconnect system/oracle@oracle;
--删除用户--
drop user ies cascade;
--删除表空间--
drop tablespace iests including contents;
--创建表空间--
create tablespace iests datafile 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORACLE\IESTS.DBF' size 200m reuse autoextend on next 50m;
--创建用户并授权--
create user ies identified by ies2010 default tablespace iests; grant resource,connect to ies; grant select any dictionary to ies; grant select any sequence to ies; grant create any table,alter any table,drop any table to ies; grant select any table,insert any table,update any table,delete any table to ies; grant create any trigger,alter any trigger,drop any trigger to ies; grant create any procedure,alter any procedure,drop any procedure,execute any procedure to ies; grant create any view,drop any view to ies; grant create any synonym to ies; grant create any snapshot to ies; exit;spool off;
3.在数据库恢复时(导入),需要停止web服务,是数据库处于不被连接的状态,否则用户删除时报错,不能被删除。如果不删除用户,只删除表空间,将导致用户下的object不能被删除(object包括function,procedure,synonym,package,Javasource,javaclass等),同样object不能被导入。
function,procedure,synonym,package,Javasource,javaclass,type 都在sys.source$下存着试图是dba_source,表是SOURCE$。如果已经停止了web服务,删除用户时如果提示:“用户当前正被连接不能删除”时,需要杀掉该进程,alter system kill session 'sid,serid#';
- oracle 自动备份、恢复功能
- oracle 自动备份、恢复功能
- 用java 实现 oracle的自动备份和恢复功能。
- windowsxp自动系统恢复功能备份
- Oracle 11gR2中针对备份恢复功能的增强
- Oracle备份恢复-手动备份
- Oracle备份恢复-RMAN备份
- Oracle 备份与恢复
- Oracle备份恢复
- Oracle 备份与恢复
- Oracle 备份与恢复
- Oracle备份与恢复
- Oracle备份与恢复
- oracle 物理备份恢复
- oracle备份与恢复
- Oracle备份与恢复
- oracle备份 恢复基础
- oracle备份与恢复
- 给深度学习入门者的Python快速教程
- QSS总结以及最近做的Qt项目
- 推荐一个系统iso网站
- PAT 甲级 1053. Path of Equal Weight (30)
- 强连通分量缩点
- oracle 自动备份、恢复功能
- 2017年9月英语总结
- UVa10288
- C#中byte类型运算
- ZooKeeper(3)创建简单的主从模式
- 利用iso制作本地yum源 http制作yum源镜像服务器
- 养兵千日,用兵一时
- 动态规划之背包问题
- Oracle安装的提醒程序