这篇文章主要介绍Oracle如何备份还原,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
创建表分区
create tablespace apps datafile '&1\apps.dbf' size 10m autoextend on next 8m;
create tablespace appsys datafile '&1\appsys.dbf' size 10m autoextend on next 8m;
创建分区表空间
create tablespace APPS_00 datafile '&1\APPS_00.dbf' size 10M autoextend on next 8M;
create tablespace APPSYS_00 datafile '&1\APPSYS_00.dbf' size 10M autoextend on next 8M;
删除用户
drop user apps cascade;
drop user appsys cascade;
创建用户
create user apps identified by cape default tablespace apps;
create user appsys identified by cape default tablespace appsys;
授权
grant dba to apps with admin option;
grant dba to appsys;
grant create any table to apps;
grant alter any table to apps;
grant drop any table to apps;
grant create any index to apps;
grant drop any index to apps;
创建目录
create or replace directory expdp_wms_dir as 'D:\data_bak\';
grant read, write on directory expdp_wms_dir to APPS;
EXP/IMP备份与还原
exp user/pwd@SID file=d:\db_20101010.dmp log=d:\db_20101010.log owner=(apps,appsys)
imp user/pwd@SID file=D:\db_20101010.dmp log=D:\db_20101010.log fromuser=apps touser=apps fromuser=appsys touser=appsys ignore=y
EXPDP/IMPDP备份还原
expdp user/pwd@SID dumpfile=DB20141216.dmp logfile=DB20141216.log schemas=(apps,appsys) directory=expdp_dir job_name=expdp_job version=11.1.0.2
impdp user/pwd@SID dumpfile=DB20141216.DMP logfile=DB20141216.log schemas=(apps,appsys) directory=impdp_dir job_name=impdp_job
表空间映射
impdp user/pwd@SID dumpfile=DB20141216.DMP logfile=DB20141216.log remap_schema=QA_SOA:SNPW remap_tablespace=DEV_ODI_USER:JJE_ODI_USER directory=impdp_dir job_name=impdp_job
忘记ORACLE的管理员sys用户密码
在服务器本地登录,无须密码
sqlplus / as sysdba
登陆之后更改密码
sql> alter user sys identified by sys;
user test lacks CREATE SESSION privilege; logon denied.
使用DBA登陆,执行下面的授权语句。
grant connect,resource to test;
grant create session to test;
以上是“Oracle如何备份还原”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!