Automatic import and export of Oracle database

Source: Internet
Author: User
Tags dba oracle database sqlplus

The automatic import and export of Oracle database has been widely used in many places. For example, once an Oracle database application system is developed, it is necessary to import the initial data into the user's Oracle database if the system is to be installed on the client computer.

Recent projects also need to implement the above features, spent some time searching for experiments, sorted as follows: First, the initial data file to be installed to INITIAL.DMP, and then install Oracle on customer calculation, and then execute batch file Impinitialdata.bat ( The same directory as the batch file and createuser.sql,initial.dmp two files) Impinitialdata.bat the following:

@echo off

Sqlplus System/manager @createuser

Imp System/manager file=initial.dmp fromuser=initialuser touser=initialuser ignore = y

The createuser above is a file with an extension of SQL. In the same directory as the batch file. Its contents are:

Create user initialuser identified by test;

Grant Dba,resource,connect to Initialuser;

Exit

Add: Drop user POWERCC cascade; Where POWERCC is the user name.

Briefly explain:

@echo off indicates that the command after it is not displayed in the Command Prompt window

Sqlplus is a tool for Oracle, you must install Oracle before you can use

System/manager is a default administrator account for Oracle, and can be replaced with another account/password if the password is locked or changed;

@createuser represents the execution of the Createuser.sql file

In the SQL file, create user xx identified by YY, which means creating a password for yy users xx;

Grant Dba,resource,connect to XX; delegate authorization to user xx Dba,resource,connect permissions

IMP for the Import Data command, the following argument file represents the database file to import; Fromuser represents the user name of the original exported database file; Touser represents the user name of the database to be imported; ignore means to ignore errors. Additional commands can be added to perform more complex operations.

Related Article

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.