常用的数据库schema迁移语句

--1. Source DB


expdp system/@ DIRECTORY=db_backup DUMPFILE=FALABELLA_SO_20080808.DMP SCHEMAS=,,, logfile=expdp_falabella_SO_20080808.log parallel=1 CONTENT=ALL COMPRESSION=ALL FLASHBACK_TIME=sysdate


--2. Target DB


alter user  account lock;
alter user  account lock;
alter user  account lock;
alter user  account lock;

SELECT 'ALTER SYSTEM KILL SESSION '''||SID||','||SERIAL#||''';' AS SQL FROM V$SESSION WHERE USERNAME IN ('','','','');


CREATE directory DB_BACKUP as '/opt/oracle/db_backup';

GRANT read,write ON directory DB_BACKUP TO public;


drop user cascade;
drop user cascade;
drop user cascade;
drop user cascade;


CREATE USER IDENTIFIED BY QUOTA UNLIMITED ON TBS_FALABELLA
DEFAULT TABLESPACE TBS_FALABELLA
TEMPORARY TABLESPACE TEMP 
/
GRANT CONNECT, RESOURCE,DBA TO ;


CREATE USER IDENTIFIED BY QUOTA UNLIMITED ON TBS_FALABELLA
DEFAULT TABLESPACE TBS_FALABELLA
TEMPORARY TABLESPACE TEMP 
/
GRANT CONNECT, RESOURCE,DBA TO ;


CREATE USER IDENTIFIED BY QUOTA UNLIMITED ON TBS_FALABELLA
DEFAULT TABLESPACE TBS_FALABELLA
TEMPORARY TABLESPACE TEMP 
/
GRANT CONNECT, RESOURCE TO ;


CREATE USER IDENTIFIED BY QUOTA UNLIMITED ON TBS_FALABELLA
DEFAULT TABLESPACE TBS_FALABELLA
TEMPORARY TABLESPACE TEMP 
/
GRANT CONNECT, RESOURCE,DBA TO ;


alter user account lock;
alter user account lock;
alter user account lock;
alter user  account lock;


impdp system/@ DIRECTORY=db_backup DUMPFILE=FALABELLA_SO_20080808.DMP LOGFILE=impdp_FALABELLA_SO_20080808.log  SCHEMAS=,,, CONTENT=ALL PARALLEL=1 TABLE_EXISTS_ACTION=REPLACE


alter user account unlock;
alter user account unlock;
alter user account unlock;
alter user  account unlock;

你可能感兴趣的:(ORACLE)