Oracle Backup and Restore (exp and imp), Export Import

ORACLE software installation

Global database name: orcl
password: admin
base directory: C: \ app \ Tony
software location: C: \ app \ Tony \ product \ 11.2.0 \ dbhome_1
database file location: C: \ app \ Tony \ oradata

Modify the user name and password after the installation finished:
sqlplus / nolog
conn / AS sysdba
SQL> the USER SCOTT IDENTIFIED BY the ALTER Tiger;
SQL> SCOTT the ALTER the USER ACCOUNT UNLOCK;

Username: SCOTT
Password: tiger
Password: tiger as sysdba

Username: SYS
password: admin
password: admin as sysdba

View deferred segment creation is turned on, the default is TRUE open, empty table that is not immediately assigned partition (Extent), so you need to export an empty table, then you need to set to FALSE
SQL> SHOW the PARAMETER deferred_segment_creation;

::备份导出,chyichin/admin@orcl 用户名/密码@数据库 
set NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
exp chyichin/admin@orcl file=tony.dmp buffer=20480000 STATISTICS=COMPUTE log=tony.log
::还原导入
set NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
imp chyichin/admin@orcl file="C:/Users/Tony/Desktop/tony.dmp" full=y buffer=2048000 ignore=y log="C:/Users/Tony/Desktop/tony2.log"

 Some system parameter settings SQL statements

--备份空表
alter system set deferred_segment_creation = false;

--关闭审计功能
noaudit create session;
noaudit session whenever successful;

--数据库添加附加日志
alter database add supplemental log data;

--保证300秒内数据库启动成功
alter system set fast_start_mttr_target=300 scope=both;

--关闭创建空表延迟创建段的功能
alter system set deferred_segment_creation=FALSE scope=both;

--设置DML操作可以在7200内使用闪回查询原始数据
alter system set undo_retention=7200 scope=both;
ALTER TABLESPACE undotbs1 RETENTION GUARANTEE; 

--数据库并行进程最大128个
alter system set parallel_max_servers=128 scope=both;

--调整进程数上限为1500
alter system set processes=1500 scope=spfile;

--设置数据库dblink最大20个,连接单个远程数据库实例上限10个
alter system set open_links=20 scope=spfile;
alter system set open_links_per_instance=10 scope=spfile;

--关闭11g默认密码180天失效的设置
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
ALTER PROFILE DEFAULT LIMIT IDLE_TIME UNLIMITED;

--将闪回权限赋予数据库用户
--grant execute on dbms_flashback to scott;

other

查询表空间
select * from dba_data_files;
删除表空间
--删除空的表空间,但是不包含物理文件
drop tablespace tablespace_name;
--删除非空表空间,但是不包含物理文件
drop tablespace tablespace_name including contents;
--删除空表空间,包含物理文件
drop tablespace tablespace_name including datafiles;
--删除非空表空间,包含物理文件
drop tablespace tablespace_name including contents and datafiles;
--如果其他表空间中的表有外键等约束关联到了本表空间中的表的字段,就要加上CASCADE CONSTRAINTS
drop tablespace tablespace_name including contents and datafiles CASCADE CONSTRAINTS;


ORA-01033: ORACLE initialization or shutdown in progress
SQLPLUS /NOLOG
connect sys/change_on_install as sysdba;
shutdown normal;
startup mount;
alter database open;
第1 行出现错误: ORA-01157: 无法标识/锁定数据文件6
alter database datafile 6 offline drop;
alter database open;



--删除database link
drop database link lportal;
drop database link wms_link; 
drop database link INTERFACE; 

--重新创建database link
create database link lportal connect to scott identified by scott using 'orcl';
create database link wms_link connect to scott identified by tiger using 'orcl';
create database link INTERFACE connect to scott identified by tiger using 'orcl';

 

Published 46 original articles · won praise 9 · views 3638

Guess you like

Origin blog.csdn.net/weixin_41896770/article/details/103476836