备份数据库 创建备份目录(用sys账号),若已创建备份目录,此步可忽略 create directory db_bak as "D: ECIMS_DB" --查看创建的目录 select * from dba_directo
create directory db_bak as "D: ECIMS_DB"
--查看创建的目录
select * from dba_directories
--删除已创建的目录
drop directory DB_BAK
格式:
drop directory 目录名
expdp XXX/XXX@XXX schemas=XXX dumpfile=XXX_20181130.dump logfile=XXX_20181130.LOG DIRECTORY=DB_BAK
语法:
expdp 用户名/密码@实例名 schemas=用户名 dumpfile=导出dump文件名.dump logfile=导出日志文件名.LOG DIRECTORY=DB_BAK
drop user XXX cascade;
格式:
drop user 用户名 cascade;
注:若删除不掉,需先删除所有会话!!!
select username, sid, serial# from v$session where username="XXX" --找到用户SESSION
格式:
select username, sid, serial# from v$session where username="用户名" --找到用户SESSION
注:若有多条会员,需批量删除
alter system kill session "249,57377" --杀掉用户SESSION "sid,serial#"
alter system kill session "250,57376" --杀掉用户SESSION "sid,serial#"
alter system kill session "251,57375" --杀掉用户SESSION "sid,serial#"
格式:
alter system kill session "sid,serial"
create user XXX identified by XXX default tablespace USERS
temporary tablespace TEMP
profile DEFAULT;
-- Grant/Revoke role privileges
grant connect to XXX;
grant dba to XXX;
grant resource to XXX;
-- Grant/Revoke system privileges
grant alter any sequence to XXX;
grant alter any table to XXX;
grant alter any trigger to XXX;
grant change notification to XXX;
grant create any procedure to XXX;
grant create any sequence to XXX;
grant create any table to XXX;
grant create any type to XXX;
grant create any view to XXX;
grant unlimited tablespace to XXX;
--------------------------------------------------------------
格式:
create user 用户名 identified by 密码 default tablespace USERS
temporary tablespace TEMP
profile DEFAULT;
-- Grant/Revoke role privileges
grant connect to 用户名;
grant dba to 用户名;
grant resource to 用户名;
-- Grant/Revoke system privileges
grant alter any sequence to 用户名;
grant alter any table to 用户名;
grant alter any trigger to 用户名;
grant change notification to 用户名;
grant create any procedure to 用户名;
grant create any sequence to 用户名;
grant create any table to 用户名;
grant create any type to 用户名;
grant create any view to 用户名;
grant unlimited tablespace to 用户名;
impdp XXX/XXX DIRECTORY=db_bak DUMPFILE=XXX.dump logfile=XXX.log REMAP_SCHEMA=XXX:XXX remap_tablespace=XXX:XXX
格式
impdp 用户名/密码 DIRECTORY=db_bak DUMPFILE=备份文件名.dump logfile=备份日志文件名.log REMAP_SCHEMA=导出用户名:导入用户名 remap_tablespace=导出表空间:导入表空间
--结束END--
本文标题: Oracle备份、还原数据库
本文链接: https://www.lsjlt.com/news/1948.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0