Oracle Database Basic Operations

Source: Internet
Author: User

--Create a tablespace (a table space can have multiple users)--
Create Tablespace Demo
DataFile ' D:\oracle\oradata\junchen\PLATFORM\demo.dbf '
Size 50m
Autoextend on;

--Create a user, and associate a tablespace--
Create user Demo
Identified by DD
Default Tablespace demo;

--Assigning permissions to users--
Grant Connect,resource to user name;
Grant CREATE view to user name;--Create views permission
Grant create sequence to user name;--Create Sequence permission
Grant SYSDBA to user name;--Administrator privileges

Grant Create session,create any table,create any view,create any index,create
Any procedure,alter any table,alter any procedure,drop any table,drop any view,drop any index,drop any procedure,
Select any table,insert any table,update any table,delete all table,dba to demo;--all rights



--Modify the data file--
--View data file path--
Select File_id,bytes,file_name from Dba_data_files;
--Re-designation of size 20m--
ALTER DATABASE datafile ' data file path ' resize 20m;



--Modify the table space to which it belongs:
ALTER TABLE name move tablespace "Table space name"

--Modify table Index to table space:
ALTER INDEX index name rebuild tablespace "Table space name"



Export Database
Exp Userid=jsmall/[email PROTECTED]/ORCL File=e:/demo.dmp
Exp Userid=dd_app/[email Protected]/prosc File=e:/dd_app.dmp
Exp Userid=dd_eflow/[email Protected]/prosc File=e:/dd_eflow.dmp
Exp Userid=auth/[email Protected]/prosc File=e:/auth.dmp
Exp Userid=sb_portal/[email Protected]/prosc File=e:/sb_portal.dmp

Import Database
Imp system/[email protected] file=f:\data. DMP full=y
Resolve Oracle "These objects are exported by xxx, not the current user" scenario
Imp userid=demo/[email protected]/prosc file=e:/demo.dmp ignore=y fromuser=demo Touser=demo
Imp userid=dd_app/[email protected]/prosc file=e:/dd_app.dmp ignore=y Fromuser=dd_app Touser=DD_APP
Imp userid=dd_eflow/[email protected]/prosc file=e:/dd_eflow.dmp ignore=y fromuser=dd_eflow Touser=DD_EFLOW
Imp userid=auth/[email protected]/prosc file=e:/auth.dmp ignore=y fromuser=auth Touser=auth
Imp userid=sb_portal/[email protected]/prosc file=e:/sb_portal.dmp ignore=y fromuser=sb_portal Touser=SB_PORTAL




--Delete--
--1, deleting tables and sequences, etc.--
--2, delete user--
Drop user username;
--3, delete table space--
Drop tablespace user name _tablespace;

Paging:
SELECT * FROM (
Select Row_.*, RowNum rownum_ from (
Querying SQL
) Row_
) where Rownum_ <= end line and rownum_ > start line;
Query total number of rows:
Select COUNT (1) from (query sql) Tmp_count;

Oracle Database Basic Operations

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.