cau lenh import trong man hinh cmd: imp <username>/<password>@
file= fromuser= touser= cau lenh xem lai du lieu file da import vao user do vao sqlplus - connect vao user da import - select object_name from dba_objects where owner = '' (viet hoa ten user) import (kieu moi) 1) tao duong dan chua file can export create directory as '' vd create directory imp as 'd:\export' 2) cap quyen cho thu muc grant on directory to <user> vd grant read,write on directory imp to public 4) expdp <user>/@ dumpfile=: logfile=: 3) vao cmd de import impdp <user>/<password>@< ten database> schemas='' remap_schema=':' dumpfile=< duong dan file export >: logfile=: 4) de xem lai duong dan file de tao. select * from all_directories where directory_name= '' hoac show parameter -----------------------------------------------------------------------------bai2 :backup full data (auto backup controlfile ) 1) vao sqlplus: sqlplus \nolog --> conn /as sysdba;--> startup mount; 2) exit; 3) rman target/ 4) configure controlfile autobackup on; 5) backup format '' database; vd: backup format 'd:\testbk\%d_%t_%s_%p'database ; 6) exit --> vao sqlplus, tao bang insert dong 7) shutdown immediate; 8) xoa het cac file trong thu muc orcl;(truoc het phai luu mot ban khac) 9)sqlplus--> startup nomount; 10) exit --> rman target/; 11) restore controlfile from autobackup ; 12) alter database mount; 13) restore database;
14) exit; * tao file redolog vao sqlplus --> conn /as sysdba; 1) recover database using backup cotrolfile 2) cancel. 3) alter database open resetlogs; ---------------------------------------------------------------------------------bai2 b: backup full data (khong back up file control) 1) startup mount 2) rman target/ 3) backup format '' database; 4) alter database open; 5) vao sqlplus, create table, insert xong commit 6) shutdown immediate , dau file data va redolog file 7) startup mount 8) restore database 9)exit 10) vao sqlplus 11) recover database until cancel 12)cancel 13) alter database open resetlogs ------------------------------------------------------------------------------------bai 2 c: neu lo xoa file temp.dbf --> tao lai 1) sqlplus 2) create temporary tablespace "" tempfile '' size <so m> extent management local uniform size 1m ; 3) alter database default tablespace 4) drop tablespace mac dinh la temp ----------------------------------------------------------------------------------------bai3: backup file theo incremental; 1) startup mount;(trong sqlplus) 2) rman target/ 3) backup incremetal level 0 format'' database; 4) alter database open; 5) exit--> vao sqlplus ; 6) create table / inset table --> commit ; 7) shutdown immediate; 8) startup mount -->exit ; 9) rman target/ 10) backup incremental level 1 format '' database; 11)shutdown immediate ;(dau cac file ) 12) startup mount; 13) restore database; 14) alter database open; 15) exit 16) sqlplus --> xem lai bang sau khi restore. -----------------------------------------------------------------------------------------
bai 4: tao file merg giua cac backup incremental 1) startup mount; (thoat) 2) rman target/; 3) backup incremental level 1 tag <'ten tag'> for recovery of copy with tag 'ten tag' database; chua cac file data trong thu muc flash_recovery_area\datafile; chua cac file backup trong thu muc flash_recovery_area\autobackup; 4) alter database open; 5) vao sqlplus, create table/insert table --> commit ; 6) shutdown immediate; 7) startup mount; 8) rman target/ 9) backup incremental level 1 tag <'ten tag'> for recovery of copy with tag 'ten tag' database; 10)recover copy of database with tag 'ten tag da dinh nghia o buoc 3'; ------------------------------------------------------------------------------------------bai 5: backup va recover du lieu ngay tai thoi diem hien tai. 1) xem co bat trang thai archivelog chua: archive log list neu la disable thi enable : alter databse archivelog. 2)phai start archiver(chuc nang tu sao chep file redolog ). xem trang thai: show parameter log_archive_start; neu chua start: alter system set log_archive_start=true scope=spfile 3) startup mount; 4) backupfull; 5) alter database open; 6) create table/ insert du lieu, commit; 7) alter system switch logfile;(n lan;insert them dong ) 8) shutdown immediate;(dau datafile ) 9) startup mount; 10 restore database; 11) alter database open; 12) recover database; ---------------------------------------------------------------------------------------------bai 6: flashback databse truoc khi flashback phai set archivelog 1)startup mount; 2)alter system set db_flashback_retention_target = 2880 (2 ngay = 48h * 60p) scope=both; 3) alter database archivelog; 4) alter database flashback on; (xem lai select flashback_on from v$database;) --------------1) tao bang va inset nhieu dong --> commit roi insert them nhieu dong nua 2) shutdown 3) startup mount 4) flashback database to timestamp(sysdate - 10/(60*24))) 5) alter database open resetlogs select xem lai; ----------------------------------------------------------------------------------
----bai 7: flashback table th : drop table 1) tao table (khong conn va tao bang user sys hay system) 2) insert dl --> commit 3) drop table; 4) flashback table to before drop [rename to ]; xem bang drop co nam trong recyclebin: select orginal_name, owner, droptime,operation,can_undrop from dba_recyclebin; th: flashback transaction tao table insert dl commit nhieu lan flashback den thoi diem can flashback; alter table enable row movement; ---------------------------------------------------------------------------------------bai 8: tao catalog 1) 2) 3) 4) 5) 6) 7) 8)
tao user gan quyen cho user exit rman catalog /@ rman> create catalog tablespace users; exit rman catalog rman/rman target sys/system@tram rman> register database;