Use of Oracle Database IMP/EXP commands

Source: Internet
Author: User

  1. Export the database as follows:
  2. Enter cmd in the command line to enter the DOS window.
  3. Enter exp ccsbi/ccsbi_jyfx@ Ccsbi_55File = d: daochu. dmp ignore = y
  4. To export the entire database.
  5. Data export:
  6.  1Export the database TEST completely, and the username system Password manager is exported to D: daochu. dmp.
  7. Exp ccsbi/ccsbi_jyfx@ Ccsbi_55File = d: daochu. dmp full = y
  8.  2Export the tables of system users and sys users in the database
  9. Exp ccsbi/ccsbi_jyfx@ Ccsbi_55File = d: daochu. dmp owner = (system, sys)
  10.  3Export the inner_policy and policy_staff_relat tables in the database.
  11. Exp aichannel/aichannel@ TESTDB2File = d: datanewsmgnt. dmp tables =
  12. (Inner_policy, policy_staff_relat)
  13.  4Set the field filed1 in table 1 in the database"00"Export data with headers
  14. Exp system/manager@ TESTFile = d: daochu. dmp tables = (table1) query ="Where filed1 like '20140901 '"
  15. The above is a commonly used export. For compression, you can use winzip to compress the dmp file.
  16. You can also add compress = y to the command above.
  17. Data Import
  18.  1Import the data in D: daochu. dmp to the TEST database.
  19. Imp system/manager@ TESTFile = d: daochu. dmp
  20. Imp aichannel/aichannel@ HUSTFull = y file = d: datanewsmgnt. dmp ignore = y
  21. The above may be a problem, because some tables already exist, and then it will report an error, the table will not be imported.
  22. Add ignore = y to the end.
  23.  2Import table 1 in d: daochu. dmp
  24. Imp system/manager@ TESTFile = d: daochu. dmp tables = (table1)
  25. The preceding import and export operations are sufficient. In many cases, you must first completely delete the table and then import it.
  26. Note:
  27. If the operator has sufficient permissions, a prompt is displayed.
  28. Databases can be connected. You can use tnsping TEST to obtain whether the database TEST can be connected.
  29. Appendix 1:
  30. Add data import permissions to users
  31. First, start SQL * puls
  32. Second, log in with system/manager
  33. Third, create user username identified by password (this step can be omitted if you have already created a user)
  34. Fourth, grant create user, drop user, alter user, create any view,
  35. Drop any view, EXP_FULL_DATABASE, IMP_FULL_DATABASE,
  36. DBA, CONNECT, RESOURCE, create session to Username
  37. Fifth, run-cmd-to enter the directory where the dmp file is located,
  38. Imp userid = system/manager full = y file = *. dmp
  39. Or imp userid = system/manager full = y file = filename. dmp
  40. Example:
  41. F: WorkOracle_Databackup> imp userid = test/test full = y file = inner_policy.dmp
  42. Screen Display
  43. Import: Release8.1.7.0.0-Production on Thursday2Month16 16:50:05 2006
  44. (C) Copyright2000Oracle Corporation. All rights reserved.
  45. Connect to: Oracle8i Enterprise Edition Release8.1.7.0.0-Production
  46. With the Partitioning option
  47. JServer Release8.1.7.0.0-Production
  48. EXPORT from EXPORT: V08.01.07Created File
  49. The ZHS16GBK Character Set and ZHS16GBK NCHAR character set have been imported.
  50. The export server uses the UTF8 NCHAR character set (possible ncharset conversion)
  51. . Importing AICHANNEL object to AICHANNEL
  52. ... Importing table..."Inner_policy"4Row imported
  53. Prepare to enable constraints...
  54. Import is terminated successfully, but a warning is displayed.
  55. Appendix 2:
  56. Oracle cannot directly change the table owner. Export/Import can be used to achieve this purpose.
  57. First create import9.par,
  58. The command is as follows: imp parfile =/filepath/import9.par
  59. The content of import9.par is as follows:
  60. FROMUSER = TGPMS
  61. TOUSER = TGPMS2 (Note: Change the table owner from FROMUSER to TOUSER. Users of FROMUSER and TOUSER can be different.
  62. )
  63. ROWS = Y
  64. INDEXES = Y
  65. GRANTS = Y
  66. CONSTRAINTS = Y
  67. BUFFER =409600
  68. File =/backup/ctgpc_20030623.dmp
  69. Log =/backup/import_20030623.log
  70. Note:
  71. 1. Add feedback = to the import/export command.1000Allows the process to display an increasing number of "..." to change the previous blinking cursor

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.