낙서장/Oracle

Oracle export/import

RunTimeException 2022. 6. 29. 09:47

oracle export import

cmd 창을 관리자 권한으로 실행 한 후 아래 명령을 입력해서

scott(사용자 계정)에 있는 모든 db 정보를 파일로 저장한다

exp userid=계정ID/계정PW file=C:\scott.dmp owner=scott

scott2유저에 dmp를 IMPORT 한다.

imp userid=계정ID/계정PW file=C:\scott.dmp fromuser=scott touser=scott2

참고

기존 scott2 계정을 삭제 후 모든 정보를 비운 후

export 받은 백업본을 이용해 복구하기

=========================================================================

SQL*Plus 에서

SQL> connect;

Enter user-name: system

Enter password:

Connected.

SQL> drop user scott2 cascade;

사용자가 삭제되었습니다.

계정을 삭제 한 후 그 계정을 다시 생성한다

SQL> create user scott2 identified by tiger;​

User created.​

SQL> grant connect,resource to scott2;

Grant succeeded.

--

imp userid=계정ID/계정PW file=C:\scott.dmp fromuser=scott touser=scott2

cmd 창을 관리자 권한으로 실행 한 후 위 명령을 입력해서 import 하면

백업받은 db 정보를 모두 저장할 수 있다.

 

exp id/pw tables=table_name file=file_name

 

imp id/pw file=file_name tables=table_name ignore=y

 

외부 DB export or import는 id/pw@IP:port/db_name 을 사용해야 한다.