Oracle-related commands under Linux

Source: Internet
Author: User
Tags dba

#注意: The Oralce command in the example is in the/home/oracle/oracle/product/10.2.0/db_1/bin directory. #你可以自己修改成自己的目录.
A. #dbstart//Start database
#dbshut//Close Database
B. #emctl start Dbconsole//Open Enterprise Manager
#emctl Stop dbconsole//Shut down Enterprise Manager
C. #lsnrctl Start//Startup monitoring
#lsnrctl Stop//Turn off monitoring
D. #emctl Start agent//open proxy
#emctl Stop agent//close Proxy
E. #sqlplus/nolog
Conn/as SYSDBA
Startup//Boot instance
Shutdown immediate//close instance
F. #tnsping 192.168.1.104//testing whether the Oracle database is
G.http://10.0.0.77:5560/isqlplus//isql*plus URL
HTTP://10.0.0.77:5560/ISQLPLUS/DBA//isql*plus dba URL
Http://10.0.0.77:1158/em//enterprise Manager 10g Database

    • To establish the tablespace and the user's steps:
    • User
    • Create: Create user username identified by "password";
    • Authorization: Grant create session to user name;
    • Grant CREATE table to user name;
    • Grant create tablespace to user name;
    • Grant CREATE view to user name;

    • Table Space
    • Create a tablespace (typically a table space with n stored data and an index space):
    • Create tablespace table space name
    • DataFile ' Path (to build the path first) \***.dbf ' size *m
    • Tempfile ' path \***.dbf ' size *m
    • Autoextend on-Automatic growth
    • --There are some commands to define the size, see the need
    • Default Storage (
    • Initial 100K,
    • Next 100k,
    • );

    • User Rights
    • To grant a user permission to use the tablespace:
    • Alter user username quota unlimited on table space;
    • or alter user username quota *m on table space;

    • --Import and export commands
    • IP Export mode: Exp demo/[email PROTECTED]:1521/ORCL file=f:/f.dmp full=y
    • Exp Demo/[email protected] file=f:/f.dmp full=y
    • Imp demo/[email protected] file=f:/f.dmp full=y ignore=y


View the directory where the tablespace files are located:
SELECT * from Dba_data_files;

The types of Oracle data dictionary views are: User,all and DBA.
User_*: Information about the object that the user owns, that is, the object information created by the user himself
All_*: Information about the objects that the user can access, that is, information about the objects created by the user, plus
Other user-created objects but the information that the user has access to
Dba_*: Information about an object in the entire database
(Here the * can be tables,indexes,objects,users and so on.) )
1. View All Users
SELECT * from Dba_user;
SELECT * from All_users;
SELECT * from User_users;
2. View User system permissions
SELECT * from Dba_sys_privs;
SELECT * from All_sys_privs;
SELECT * from User_sys_privs;
3. View User Object permissions
SELECT * from Dba_tab_privs;
SELECT * from All_tab_privs;
SELECT * from User_tab_privs;
4. View all roles
SELECT * from Dba_roles;
5. View the roles owned by the user
SELECT * from Dba_role_privs;
SELECT * from User_role_privs;
6. View the default tablespace for the current user
Select Username,default_tablespace from User_users;
7. View specific permissions for a role
such as Grant connect,resource,createsession,create view to TEST;
8. View resource with those permissions
With select * from Dba_sys_privs WHERE grantee= ' RESOURCE ';

SQL Code
--Delete empty tablespace, but no physical file
Drop Tablespace tablespace_name;
--Delete non-empty table spaces, but not physical files
Drop tablespace tablespace_name including contents;
--Delete empty table space, including physical files
Drop tablespace tablespace_name including datafiles;
--Delete a non-empty tablespace containing physical files
Drop tablespace tablespace_name including contents and datafiles;
--Add Cascade CONSTRAINTS if the table in the other tablespace is associated with a field of a table in this table space with a constraint such as a foreign key.
Drop tablespace tablespace_name including contents and datafiles CASCADE CONSTRAINTS;

Oracle-related commands under Linux

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.