Start from the beginning Db-oracle

Source: Internet
Author: User
Tags gpg sqlplus

RPM-IVH http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
RPM-IVH http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
RPM--import/etc/pki/rpm-gpg/rpm-gpg-key-epel-6
Yum Install Rlwrap
Su-oracle
echo "Alias sqlplus= ' Rlwrap sqlplus '" >> ~/.bash_profile
SOURCE ~/.bash_profile
Sqlplus/as SYSDBA
Show user;
Alter user HR identified by ZXCASD account unlock;
Exit
Sqlplus HR/ZXCASD
Show user;
SELECT * from Session_privs;
SELECT * from Dba_sys_privs;
SELECT * from Dba_tab_privs;
Alter user HR identified by 123456 replace ZXCASD;

Select table_name from User_tables;

Set PageSize 200

Set Linesize 200
Desc jobs
SELECT * from Jobs;
DESC Locations
SELECT * from locations;

Select Userenv (' language ') from dual;

Exit

Export Nls_lang=american_america. Zhs16gbk

Back up relevant content first, complete, user, table
Exp help=y
Exp hr/123456
EXP system/123456 buffer=64000 file=full.dmp full=y
EXP hr/123456 buffer=64000 file=hr.dmp owner=hr
EXP hr/123456 buffer=64000 file=hr-xue.dmp Tables=xue

Imp hr/123456
IMP system/123456 buffer=64000 file=full.dmp full=y
IMP hr/123456 buffer=64000 file=hr.dmp fromuser=hr touser=hr
IMP hr/123456 buffer=64000 file=hr-xue.dmp tables=xue ignore=y

Only several modes of export were tested, and the imported table mode, user mode. The other import did not succeed.

If the table structure exists, IMP should add ignore=y, ignoring the error. or directly delete the table data and table structure, with drop without delete.

Delete and change the related rows or tables, and then use the backup data for recovery.
Sqlplus hr/123456
Set PageSize 200
Set Linesize 200
CREATE TABLE xue (ID integer,name varchar (25));
Insert into Xue values (1, ' Wang ');
Insert into Xue values (2, ' Liu ');
Commit
Delete a table
drop table Xue;

If there is a table with indexed relationships, use the following
DROP TABLE mytest cascade constraints;
Leaves the table structure, deleting one row or all of the data.
Delete from regions where region_id=5;
Delete from regions

User Mode Recovery

Remove all objects under the user, and then restore again so that there is no residue.

Use the SYS account to operate

Drop user HR cascade;
To exit all HR user connections to execute correctly.
Drop tablespace USERS including CONTENTS;
You cannot delete the default persistent table space.
Create user HR profile default identified by 123456 default tablespace USERS temporary tablespace TEMP account unlock;
Grant DBA to HR;
Grant Connect,resource to HR;

Imp hr/123456 buffer=64000 file=hr.dmp fromuser=hr touser=hr will not be an error.

Start from the beginning Db-oracle

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.