1: create a user:
Create temporary tablespace user_temptempfile 'd: \ app \ topwqp \ oradata \ orcl \ user_temp.dbf 'size 500 m autoextend onnext 50 m maxsize 2048 mextent management local; Create tablespace ts_mydbloggingdatafile 'd: \ app \ topwqp \ oradata \ orcl \ comment 'size 500 mautoextend onnext 50 m maxsize 2048 Mexican management local; drop user mydb cascade; create user mydb identified by mydbdefault tablespace ts_mydbtemporary tablespace user_temp; grant connect, resource, DBA to mydb;
The preceding command indicates:
Create a temporary tablespace. The temporary file name is the file actually stored in Oracle. Size indicates the size of the tablespace, and autoextend indicates the extended size when the capacity is full.
Before creating a user, cascade and delete user information,
Create the user name and password, and then authorize the user. The connect, resource, and DBA permissions are granted here, and detailed authorization is required to re-query the information.
2. Import the database
Set userid = mydb/mydb @ orclset fromuser = testset touser = mydbset filename = test_bak2013-03-22.dmpSET LOGNAME = mylog. logimp % userid % file = % filename % fromuser = % fromuser % touser = % touser % log = % LOGNAME %
Userid is used to import the username/password of the database to be imported and the database name,
Fromuser refers to the User Name of the backup database, touser is used for the user in the database to be imported, and filename is used to specify the backup DMP database file required for import.
LOGNAME indicates the log file. Note that the imported database must be in the same location as the script.
Usage: copy or aboveCodeSave it to The. BAT file and double-click it.
3: export the database
Set curdate = % Date :~ 0, 10% set userid = test/test @ orclset owner = testset filename = test_bak % curdate %. dmpset LOGNAME = test_bak % curdate %. logexp % userid % file = % filename % owner = % owner % log = % LOGNAME %
Here, userid is the username and password for import, curdate is used to obtain the current date, owner is used to indicate which user to export, filename is the exported file name, and LOGNAME is the exported log file,
Then run the Export command.