Logical Backup Skill Building

20
SkillBuilders Advertisement Instructor's Notes (If applicable) Lesson 20: Logical Backups This hands-on lesson will teach you how to use the import and export utilities to perform logical backups of the database. Other Text: (Examples or comments displayed on slide, if any). SkillBuilders Advertisement

description

ffff

Transcript of Logical Backup Skill Building

SkillBuilders Advertisement Instructor's Notes(If applicable) Lesson 20: Logical Backups This hands-on lesson will teach you how to use the import and export utilities toperform loical backups of the database! "ther Text#($xamples or comments displayed on slide% if any)!SkillBuilders Advertisement Instructor's Notes(If applicable) &oical backups are taken with the $xport utility! They are called 'loical'backups% because loical database ob(ects such as a table are backed up! $xportwrites output to a binary file% which can be read by the Import utility! The export utility is most often used to create secondary backups (what if your)*A+ backup sets are lost,) and to move database ob(ects by -T./in toanother server and importin! "ther Text#($xamples or comments displayed on slide% if any)!.hysical backups backup datafiles! 0se )*A+ for thisSkillBuilders Advertisement Instructor's Notes(If applicable) The $xport utility creates a binary dump file containin the ob(ect definitions(11&) and data (if )"2S34 parameter used% otherwise the file contains (ustthe 11&)! The file is in an "racle proprietary format5 the Import utility must beused to restore the file! The $xport utility is used when the database is open! 6owever% consistencymust be considered if more than one related ob(ect is bein exported! $xportdoes not% by default% maintain consistency across tables! So% you will need toeither STA)T0. )$ST)I7T or use the $xport 7"+SIST$+T34 parameter!6owever the latter solution may re8uire very lare rollback or undo sementsmakin this a difficult solution! $9.")T (and I*.")T) can be run from the operatin system command line%from command files (scripts) and from "racle $nterprise *anaer ("$*)! "ther Text#($xamples or comments displayed on slide% if any)!SkillBuilders Advertisement Instructor's Notes(If applicable) The $xport utility supports several modes! In each mode% we can re8uest that(ust the 11& to recreate the ob(ect be exported or% perhaps more commonly%re8uest that the 11& and the contents of the tables be exported! $xport supports the followin modes# o Table : The table structure (11& to recreate)% data (optional)% indexesand rants are exported! This can be limited to a partition of a table! o 0ser or Schema mode : All ob(ects owned by a user are exported!2arnin# ;rants and indexes created by another user on the usersob(ects are not exported! S to determine if ?rdparty rants exists% for example# S$&$7T @ -)"* 1BA=TAB=.)I>S 26$)$ rantor A3"wner5 To find indexes created by ?rd parties% 8uery 1BA=I+1$9$S%for example# S$&$7T @ -)"* 1BA=I+1$9$S 26$)$ owner A3table=owner5 o Tablespace : All ob(ects within the specified tablespace are exported!This includes indexes on the ob(ects% even if the indexes are not in thesame tablespace! o 1atabase : All 11& and data (optional) needed to recreate the entiredatabase is exported!"ther Text#($xamples or comments displayed on slide% if any)!All modes support 11&-only or 11& and dataSkillBuilders Advertisement Instructor's Notes(If applicable) $9.")T can be invoked from the "S command line from the server or anyclient that has had client administrator installation performed on it! (The "Scommand is '$9.'!) In this example (not all output shown)% the followin options are used# o 0S$)I13 (The strin 0S$)I13 can be omitted if the first optionpassed is the usernameBpassword) : Specify the username to connect tothe database and run the export! The user re8uires the$9.=-0&&=1ATABAS$ role to export ob(ects other than their own! o "2+$)3 - This denotes a user-level export! Specify the user or acomma delimited list of users whose ob(ects should be exported! o 7"*.)$SS3+ : This prevents export from creatin 11& which will%when the ob(ect is imported% create a lare enouh initial extent so thatthe entire ob(ect (e!! table% cluster or index) will fit into a sinle extent!(The default is 7"*.)$SS34% which is a holdover from the old dayswhen this was a ood idea!) 7ompressin into a sinle extent is notnecessary for better performance and can lead to problems (e!! what ifyou do not have enouh space for a sinle lare extent,)! +otes continue on the next paeC"ther Text#($xamples or comments displayed on slide% if any)!7#DEexp systemBdaveFanela owner3dave compress3n file3c#DbackupDdave!dmp consistent3y lo3c#DbackupDdave!lo$xport# )elease G!H!I!J!I - .roduction on *on Kun G JI#HJ#JL HII? 7onnected to# "racleGi $nterprise $dition )elease G!H!I!J!I - .roduction 2ith the .artitionin% "&A. and "racle 1ata *inin options KServer )elease G!H!I!J!I - .roduction $xport done in 2$M*S2I+JHLH character set and A&JN0T-JN +76A) character set About to export 1A>$/s ob(ects !!! ! exportin database links ! exportin se8uence numbers ! exportin cluster definitions ! about to export 1A>$/s tables via 7onventional .ath !!! ! ! exportin table A&&=*4=11& H rows exported ! ! exportin table B&"B=TAB&$ I rows exported ! ! exportin table 70ST I rows exported ! ! exportin table 70ST"*$) JO rows exported"utput messaesSkillBuilders Advertisement Instructor's Notes(If applicable)o -I&$3 - Specify the path and file name of the output dump file (I!e! thefile that contains the exported data)! The default is '$9.1AT!1*.' inthe current workin directory! o 7"+SIST$+T3 - '4' re8uests a read-consistent version of all ob(ects!This should be used if more than one related ob(ect is bein exportedand the ob(ects are available for update! 7an re8uire very lare rollbackor undo sements makin this a difficult solution! 7onsider STA)T0.)$ST)I7T to prevent access by other users instead of this option! o &";3 - The path and name of a file where a lo of the export processwill be written! The messae we hope for% I!e! the messae that indicatesall is well can be found at the end of the lo file# '$xport terminatedsuccessfully without warnins!' "ther Text#($xamples or comments displayed on slide% if any)!SkillBuilders Advertisement Instructor's Notes(If applicable) $xport supports many useful parameters# o .A)-I&$3 - Specify a parameter file that contains the parameters for beused in the export! o -0&&3 - Invokes a full database export! The entire database is exported!o -&AS6BA7P=S7+3 B -&AS6BA7P=TI*$3 - 0se to et a consistentexport as of a previous System 7hane +umber (S7+) or time! The timeneeds to be in the format specified! +ote that if the 0+1" is notavailable in the 0+1" sements% the export will fail! $xecute privileeon the 1B*S=-&AS6BA7P packae is re8uired% in addition to exportprivilees! "racleGi feature! +ote that the flashback export does not support ob(ects that have been dropped%altered or truncated!"ther Text#($xamples or comments displayed on slide% if any)!7#DEexp parfile3c#DbackupDdave!parQoracleF1evRS exp systemBdave file3fulldb full3y consistent3y7#DEexp systemBdaveFanela owner3dave file3c#DbackupDdave!dmp consistent3y lo3c#DbackupDdave!lo flashback=scn3J?HJJLML7#DEexp systemBdaveFanela ! ! ! flashback=time3/'HII?-IN-IG JJ#II#II'/SkillBuilders Advertisement Instructor's Notes(If applicable) $xport features% continued# o TAB&$S.A7$S - Specify one or a comma-delimited list of tablespaces!)elated index definitions are exported% even if they do not reside in thespecified tablespace(s)! o TAB&$S - Specify one table% a comma-delimited list of tables or a strinwith wildcards T or =! The use of wildcards is an "racleGi feature! The11&% data% indexes and rants are exported! .artitions can be exportedwith the colon syntax% for example TAB&$S3dave!lare=table#partJ o