[Oracle Use (2)] Simple use of Oracle

Source: Internet
Author: User
Tags set time sqlplus

1:oracle's Services

Oracleservice + SID                    # database service Oracleoradb10g_home1listener           # Database listener service.

2: Start the native database:

Start Oracleservice + SID: Database service

Log in to Oracle using the Sqlplus tool

Sys/tiger System Super Administrator (All rights to start/close/backup/restore/database management)

System/tiger Administrator (Create/modify/delete weights for individual Scheam objects)

Scott/tiger Test Users


Sqlplus 3 ways to sign in: Command Window

A: Direct input: Sqlplus
User name: Sys
Password: Tiger as Sysdba


B: Enter sqlplus directly specify user name and password

Sqlplus Sys/tiger as Sysdba

Sqlplus Sytem/tiger

C: Start sqlplus without logging in

Sqlplus/nolog

Connect System/tiger;

Conn (abbreviated) Sys/tiger as SYSDBA

3: Connect to the network database

3.1: Network database to open (database service) and monitoring services.

Read the Listener.ora file.

LISTENER =  (description_list = (    DESCRIPTION = (      address_list = (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC))      )      (Address_list = (ADDRESS = (PROTOCOL = TCP) (HOST = 11-55) (PORT = 1521))))  

Through the TCP/IP protocol, listen for 1521 of the ports on the 11-55 host.


3.2: The source client configures the host string information to be connected via Tnsname.ora.

Orcl_xxx =  (DESCRIPTION = (    ADDRESS = (PROTOCOL = TCP) (HOST = 11-55) (PORT = 1521))    (Connect_data =      (SERV ER = dedicated)      (service_name = ORCL)    )  )

ORCL_XXX: Host string.


3.3: Use the source client's sqlplus to connect to the edge.

Sqlplus the user name/target server password @ host string for the target server.

Sqlplus System/[email protected]_xxx

Sqlplus Sys/[email protected]_xxx as Sysdba

4: Authorization Authentication for database connections

Sqlnet.ora file
Sqlnet. Authentication_services= (NONE)

NTS: Authorized authentication of the operating system

NONE: Authorized authentication of the database


5: Start monitoring and shutdown monitoring

Operating system commands: NET Start/stop oralceora10g_home1tnslistener

Oracle Commands: Lsnrctl start/stop (Listenercontrol)


6: Start the database and close the database

    Operating system commands: NET Start/stop oracleserviceorcl Oracle Commands: Startup/shudown (is sqlplus command)
Shutdown # normal shutdown shutdown immedate # shut down now startup # Normal startup startup Nomount # Boot to not load database state startup mount # Boot to load database file state ALTER DATABASE open # to get the databases started.

  

7: Verify that the Listener and database are starting normally.

Lsnrctl start net start ORACLESERVICEORCL Sqlplus/nolog Conn Sys/tiger as SYSDBA shutdown immediate startup

8:oracle instances with Oracle databases.

Oracle instances: Memory management + process management (process re-processing threads)

Oracle Database: Data files + log files + control files.

The Oracle instance loads the database.

Startup Nomount: Booting to the stage of loading the control file

Startup mount: Booting to the stage of loading the data file

ALTER DATABASE open: Changes the databases to a startup state.

Rman/dabase Recover/flash Recover


9:sqlplus Tools:

A: Use in DOS

2 Types of statements:

SQL statement: Insert/update/delete/select/create, you must end with a semicolon.


Common commands:

                  DESC table name                connect        setspool Help Index  --view Sql*plus can statement @--Execute SQL script file. @@--executes another script in one script/ends and executes the SQL statement. Column Field name format A20 set field format connect connect user name edit the last SQL statement in the buffer. When the edit is complete, exit the host invoke operating system (DOS) command with/to execute exit. Prompt output content (script comment hint) set settings Oracle environment variable set time onset server_output onalter session set nls_date_format= ' YYYY-MM-DD '; show User;spool file path; Spool OFF: Logs the process performed by Sqlplus to a file.

B:oracle's SQL Plus interface


10: Writing Database Scripts

Create a user. If the password is numeric, create user java1411 identified by "123" with double quotation marks: System permissions: System_privilege_mapgrant create session to java1411; Object permissions: Select |insert|update|delete Grant Select on Scott.dept to java1411; role permissions grant connect to java1411;grant resource to J ava1411; grant permission to user; Reclaim permissions revoke permissions from user;

  

[Oracle Use (2)] Simple use of 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.