Friday, December 20, 2024

.::: Backup restore Export import expdb impdb from schema to another schema in oracle :::.

 

1. create another schema & check

CREATE USER aisyah_training IDENTIFIED BY hanin;
GRANT CONNECT, RESOURCE,oem_monitor TO aisyah_training;
ALTER USER aisyah_training QUOTA UNLIMITED ON USERS;

-- Membuat user aisyah_training dengan password oracle
CREATE USER aisyah_training IDENTIFIED BY hanin;

-- Memberikan hak akses dasar kepada user aisyah_training
GRANT CONNECT, RESOURCE,oem_monitor TO aisyah_training;

-- Memberikan hak akses untuk melakukan aisyah_trainingistrasi
GRANT CREATE SESSION TO aisyah_training;
GRANT UNLIMITED TABLESPACE TO aisyah_training;
GRANT DBA TO aisyah_training;

-- Memberikan hak akses untuk membaca data dictionary (opsional)
GRANT SELECT ANY DICTIONARY TO aisyah_training;

SELECT username, account_status, created,expiry_date, profile,last_login
FROM dba_users where inherited='NO'
 

2. backup database

expdp aisyah/hanin@localhost:1521/tgh DIRECTORY=DATA_PUMP_DIR DUMPFILE=aisyah_schema.dmp LOGFILE=aisyah_schema.log SCHEMAS=aisyah
 

3. check aisyah_training before restore

select * from tab;
 

4. import database from schema aisyah


impdp aisyah_training/hanin@tgh DIRECTORY=DATA_PUMP_DIR DUMPFILE=aisyah_schema.dmp LOGFILE=import_force.log REMAP_SCHEMA=aisyah:aisyah_training TABLE_EXISTS_ACTION=REPLACE
 

5. import database from schema aisyah without create schema

impdp aisyah/hanin@tgh DIRECTORY=DATA_PUMP_DIR DUMPFILE=aisyah_schema.dmp LOGFILE=import_force.log REMAP_SCHEMA=aisyah:aisyah_study TABLE_EXISTS_ACTION=REPLACE
 

6. check after restore 
 
 


 7. login aisyah_study

 8. check user/schema
 


No comments:

Post a Comment

Popular Posts