Exp/imp three modes-full, user, table

Source: Internet
Author: User

Exp/imp three modes-full, user, tableOriginal Address http://www.2cto.com/database/201305/214019.htmlThe  oracle database has two types of backup methods. The first class is a physical backup, which implements a full database recovery, but the database must be run in the back-up mode (the business database runs in non-return mode) and requires a great deal of external storage devices such as a tape library, a second type of backup as a logical backup, a business database in this way,  This method does not require that the database be run in the back-up mode, it is simple to backup, and can not require an external storage device. Database logical backup Method The logical backup of the Oracle database is divided into three modes: Table backup, user backup, and full backup.   Basic syntax and examples: 1, Exp: There are three main ways (complete, user, table)  1, complete: exp system/manager buffer=64000 file=c:\full. DMP Full=y back up the complete database. The business database does not use this backup method. The backup command is: Exp ICDMAIN/ICD rows=y indexes=n compress=n buffer=65536 feedback=100000 full=y  file=exp_.dmp log= Exp.log If you want to perform a full export, you must have special permissions! Otherwise, you will get an error: Exp-00023:must is a DBA to do full Database or tablespace export 2, user mode: expsonic/s Onic    buffer=64000 File=c:\sonic. DMP Owner=sonic All objects sonic by the user are output to a file. Backs up all objects in a user mode. The business database typically uses this backup method. If backing up to a local file, use the following command:  exp icdmain/icd owner=icdmain rows=y indexes=n compress=n buffer=65536 feedback=100000 file= Exp.dmp Log=exp.log If you are backing up to a tape device directly, use the following command:  exp icdmain/icd owner=icdmain rows=y indexes=n compress=n buffer=65536 feedback=100000 volsize=0 file=/dev/rmt0 log=exp.log Note: If the disk has space, it is recommended to back up to disk and then copy to tape. If the amount of database data is small,Back up in this way.  3, table mode: EXP sonic/sonic   buffer=64000 file=c:\sonic. DMP owner=sonic tables= (SONIC) the User SONIC table SONIC is exported to back up the object (table) specified in a user mode. The business database typically uses this backup method. If backing up to a local file, use the following command: Exp icdmain/icd rows=y indexes=n compress=n buffer=65536 feedback=100000 volsize=0 file=exp.dmp log= Exp.log tables=tab1,tab2,tab3  If you are backing up to a tape device directly, use the following command: Exp icdmain/icd rows=y indexes=n compress=n buffer=65536 feedback=100000 volsize=0 file=/dev/rmt0 log=exp.log tables=tab1,tab2,tab3  Note: When disk space allows, you should back up to the local server before copying to tape. For speed reasons, try not to back up directly to the tape device.  2, IMP: There are three modes (complete, user, table) 1, complete: IMP system/manager buffer=64000 file=c:\full. DMP Full=y If the backup method is full mode, the following recovery methods are used: Imp system/manager rows=y indexes=n commit=y buffer=65536 feedback=100000 ignore=y Volsize=0 full=y file=exp.dmp log=imp.log  2, user mode: Imp sonic/sonic buffer=64000 file=c:\sonic. DMP fromuser=sonic touser=sonic All Objects SONIC by the user are imported into the file. You must specify the Fromuser, touser parameter so that data can be imported. This method will be restored based on data backed up in user mode.  2.1. Restore the full contents of the backup data if you restore from a local file, use the following command: Imp icdmain/icd fromuser=icdmain TOUSER=ICDMAin rows=y indexes=n commit=y buffer=65536 feedback=100000 ignore=n file=exp.dmp log=imp.log  If recovering from a tape device, use the following command: Imp Icdmain/icd fromuser=icdmain touser=icdmain rows=y indexes=n commit=y buffer=65536 feedback=100000 ignore=n volsize=0 File=/dev/rmt0 log=imp.log 2.2. Restore the specified table from the backup data if you restore from a local file, use the following command: Imp icdmain/icd fromuser=icdmain touser=icdmain rows=y indexes=n commit=y buffer=65536 feedback=100000 ignore=n volsize=0 file=exp.dmp log=imp.log tables=t1,t2,t3; 3, table mode: Imp SONIC/SONIC     buffer=64000 File=c:\sonic. DMP owner=sonic tables= (SONIC)   So the user SONIC table SONIC is imported. This method restores the data backed up according to the table schema.   3.1 Restore full contents of backup data        imp icdmain/icd fromuser=icdmain touser=icdmain rows=y indexes=n Commit=y buffer=65536 feedback=100000 ignore=n file=exp.dmp log=imp.log If recovering from a tape device, use the following command: Imp ICDMAIN/ICD fromuser= Icdmain touser=icdmain rows=y indexes=n commit=y buffer=65536 feedback=100000 ignore=n volsize=0 file=/dev/rmt0 log= imp.log 3.2 restore the specified table in the backup data: If you restore from a local file, use the following commandOrder: Imp Icdmain/icd fromuser=icdmain touser=icdmain rows=y indexes=n commit=y buffer=65536 feedback=100000 ignore=n file= Exp.dmp Log=imp.log tables=t1,t2,t3  If recovering from a tape device, use the following command: Imp icdmain/icd fromuser=icdmain touser=icdmain rows=y Indexes=n commit=y buffer=65536 feedback=100000 ignore=n volsize=0 file=/dev/rmt0  log=imp.log tables=t1,t2,t3  3, Character set Description: Export side: The character set of the client should be set to the same character set as the database   view the character set of the database:sql> select Userenv (' language ') from Dual; userenv ( ' LANGUAGE ')--------------------------------------------------------------------------------American_america. al32utf8  View the character set of the client (operating system): Echo $NLS _lang Modify the client character set: Export Nls_lang=american_america. Al32utf8 Export conversion process     in the export process, if the source database character set is inconsistent with the export user session character set, character set conversion occurs and the ID number of the export user session character set is stored in several bytes of the header of the exported file. The loss of data may occur during this conversion. Example: If the source database uses ZHS16GBK, and the export user session character set uses US7ASCII, because ZHS16GBK is a 16-bit character set and Us7ascii is a 7-bit character set, the Chinese characters cannot find the equivalent character in Us7ascii during this conversion , so all Chinese characters will be lost and become "?? "Form, the resulting DMP file after conversion has already occurred with data loss. Therefore, if you want to export the source database data correctly, the user session character set in the export process should be equal to the source database character set or the superset of the source database character set    Import side: 1. Oracel server-side character set; 2. The character set of the Oracle client side; 3. The character set of the DMP file. When doing data import, these three character sets are required to be imported in a correct way. Import conversion Process     (1) Determine the export database character set environment               by reading the export header, you get the character set settings of the exported file     (2) determine the character set of the import session, which is the NLS_LANG environment variable used by the import session     (3) Imp read export file               Read the export file character set ID, and compare the Nls_lang of the import process     (4) If the export file character set is the same as the import session character set, no conversion is required within this step,             If different, you need to convert the data to the character set used by the import session. As you can see, two character set conversions occurred during the import of data into the database      First: the conversion between the character set of the import file and the character set used by the import session, if the conversion process does not complete correctly, Import to the target database cannot be completed.     Second: Imports the transition between the session character set and the database character set.

Exp/imp Three modes-full, user, table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.