Oracle, Postgres, MySQL database build, create user, lead export backup summary

Source: Internet
Author: User

What this article contains: Use commands to manipulate import and export of Oracle, Postgres, MySQL, including logging on to data

Note: I am using the Center OS operating system in the company, so both Oracle and Postgres are used in Linux and not tested in other tools, and MySQL is used on its own laptops, both under Linux and DOS commands.

1.Oracle:

    • Switch to Oracle User: su-oracle
    • Login database:sqlplus username/password @172.10.103.78:1521/orcl as SYSDBA; (user name can be used in system: SYS)
    • Creating tablespace: Createtablespace table space name datafile '/xx/xxx/xx.dbf ' size 1000M autoextend on next 100M;
    • Creating User: Create user usernameidentified by password default tablespace table space;
    • Authorization:grant CONNECT,RESOURCE,DBA to user name; (Subject to availability)

  

  Note: empty table processing may be required before exporting a table:

    Select COUNT (1) from user_tables where num_rows = 0; --Query the number of empty tables

    Select ' ALTER TABLE ' | | table_name | | ' Allocate extent; ' from user_tables where num_rows = 0;

    • Export:EXP user name/password @ip:sid/orcl file=/xxx/xxx/xx.dmp such as: Exp platform/[email PROTECTED]:1521/ORCL file=/data/oracle /platform_20180824.dmp;
    • Import:imp username/password @ip:sid/orcl file=/xxx/xxx/xxx.dmp ignore=y full=y; such as: Imp platform/[email protected]:1521/orcl file=/data/oracle/platform_20180824.dmp ignore=y full=y;

  

Other operations

    • Check User: SELECT * from Dba_users;
    • Query use tablespace: Select Tablespace_name from User_tables Group by Tablespace_name;
    • Query the current user default tablespace: Select Default_tablespace from dba_users where username= ' username ';
    • View table space Name, path: Select T1.name, t2.name from V$tablespace T1, V$datafile T2 where T1.ts #=t2.tx#;

2.postgres

  

Oracle, Postgres, MySQL database build, create user, lead export backup summary

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.