Oracle数据备份

  • 介绍

本文介绍有关Oracle数据备份和恢复的知识。

select username,default_tablespace from user_users;

  • 备份

expdp pt/pt dumpfile=test.dmp

下面是一个完整的备份脚本,自动删除三个月前的:

  • 压缩

备份后的文件比较大,可以使用7zip来进行压缩。下面的命令会把test.dmp压缩成test.7z并删除原文件:

7z -sdel a test.7z test.dmp

  • 表空间

drop tablespace ts_pt including contents and datafiles;

create tablespace ts_pt logging datafile 'd:\ts_pt.dbf' size 1000m autoextend on next 32m maxsize 2000m extent management local;

create temporary tablespace tempfile 'd:\ts_pt_tmp.dbf' size 1000m autoextend on next 32m maxsize 2000m extent management local;

alter user user_name quota unlimited on tablespace_name;

  • 用户

create user demo identified by demo

create user pt identified by pt default tablespace ts_pt temporary tablespace ts_pt_tmp;

grant create session to demo

grant connect, resource to demo

grant create any table to demo

grant insert any table to demo

grant update any table to demo

alter user demo quota unlimited on users

$ORACLE_HOME/NETWORK/ADMIN/tnsnames.ora

  • 监听器

lsnrctl status

lsnrctl start

shutdown normal

startup mount

alter database open

发表评论

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