sqlplus /nolog
connect system/password@orcl as sysdba
①テーブルスペースの作成
CREATE TABLESPACE "USR_DB"
LOGGING
DATAFILE 'C:\oracle\oradata\orcl\USR_DB.ora' SIZE 100M REUSE
AUTOEXTEND
ON NEXT 10M MAXSIZE UNLIMITED DEFAULT
STORAGE ( INITIAL 128K NEXT 128K MINEXTENTS 1 MAXEXTENTS
UNLIMITED PCTINCREASE 0 );
②一時表領域の作成
CREATE TEMPORARY TABLESPACE USR_DB_TEMP
TEMPFILE 'C:\oracle\oradata\orcl\USR_DB_TEMP.ora' SIZE 100M
AUTOEXTEND ON
;
③ユーザの作成
CREATE USER "USR_DB" PROFILE "DEFAULT" IDENTIFIED BY "PASSWORD"
DEFAULT
TABLESPACE "USR_DB" TEMPORARY
TABLESPACE "USR_DB_TEMP" ACCOUNT UNLOCK;
GRANT UNLIMITED TABLESPACE TO "USR_DB";
GRANT SELECT ON "SYS"."V_$SESSION" TO "USR_DB";
GRANT "CONNECT" TO "USR_DB";
GRANT "RESOURCE" TO "USR_DB";
④データベースのエクスポート(バッチファイル)
@echo OFF
for /F "tokens=1-3 delims=/ " %%a in ('date /t') do SET DT=%%a%%b%%c
for /F "tokens=1-2 delims=: " %%a in ('time /t') do SET TM=%%a%%b
exp system/password@orcl owner=matrix_dev buffer=1000000 file=usr\%DT%%TM%_usr_dev.dmp log=usr\%DT%%TM%_usr_devlog
⑤データベースのインポート
imp system/password@orcl fromuser=usr_dev touser=USR_DB buffer=10000000 file=C:\TLT\DB\200908170115_usr_dev.dmp