Oracle backup and recovery scripts

Source: Internet
Author: User

Oracle backup and recovery Script 1 backup [plain] @ echo off set oracle_username = sorted set oracle_password = YOUR_PASSWORD set local_tnsname = LOCAL_TNSNAME set url = % oracle_username %/% oracle_password % if not % local_tnsname % = "" set url = % url % @ % local_tnsname % www.2cto.com ensure that there is no file exp % url % file = % oracle_username % in the same directory during rem execution. dmp log = % oracle_username %. log can save the above script as a bat file for execution. The script exports all the content of user YOURORACLE_USERNAME in the database specified by local_tnsname to the YOURORACLE_USERNAME.dmp file, and writes the log to YOURORACLE_USERNAME.log. 2. Restore 2.1 to create a USER. Step 1: completely delete the USER YOURORACLE_USERNAME (if this USER exists): [SQL] DROP USER YOURORACLE_USERNAME CASCADE Step 2: Create a tablespace and set YOUR_TABLESPACE as needed, and maxsize. [SQL] create tablespace YOUR_TABLESPACE logging datafile 'd: \ oracle \ product \ 10.2.0 \ oradata \ YOUR_TABLESPACE.dbf 'size 512 m autoextend on next 64 m maxsize 1024 m extent management local; step 3, CREATE this USER [SQL] create user YOURORACLE_USERNAME identified by YOUR_PASSWORD default tablespace YOUR_TABLESPACE temporary tablespace temp Step 4, GRANT permissions [SQL] GRANT DBA TO YOURORACLE_USERNAME WITH ADMIN OPTION 2.2 restore command line WITH IMP Run this script www.2cto.com [plain] imp YOURORACLE_USERNAME/YOUR_PASSWORD @ LOCAL_TNSNAME FILE = YOURORACLE_USERNAME.DMP LOG = required FULL = Y 3. Use windows batch processing to call sqlplus to execute the SQL statement: [plain] @ echo off rem sqlplus username/password @ service @ mysql. SQL sqlplus YOURORACLE_USERNAME/YOUR_PASSWORD @ LOCAL_TNSNAME @ 20121228. SQL exit where 20121228. SQL is the SQL script to be executed. Note: YOURORACLE_USERNAME, YOUR_PASSWORD, and LOCAL_TNSNAME must be replaced with a specific string based on the actual situation.

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.