No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

eSight V300R010C00 Maintenance Guide 08

Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Oracle Database Command Reference

Oracle Database Command Reference

This topic describes common Oracle database commands and their functions and application cases.

For details about more command references, see the Oracle command reference manual.

sqlplus

The sqlplus command is used to connect to the Oracle database. You can run SQL statements in the SQL command line window or configure the Oracle database.

Syntax

sqlplus Parameter

Parameter Description

Parameter

Description

/ as sysdba

/ as sysdba indicates that the user connects the Oracle database as sysdba. The sysdba user has permission to start and stop the Oracle database. This connection mode is applicable only to the Oracle user.

dbuser/password

dbuser/password indicates that the database user connects the Oracle database as dbuser. password is the password of the dbuser user. In this mode, the dbuser user performs operations according to the permission assigned.

NOTE:

Only parameters that are used to access the Oracle database are described here. They are classified into two types: / as sysdba and dbuser/password. For more parameter setting methods, see the related documents provided by the Oracle company.

Example

Assume that the root user already logs in to the SUSE Linux. The OS user name of the Oracle database is oracle.

On the command-line interface (CLI), run the following command to connect to the Oracle database:

  • Method 1: Run the following commands to switch to the oracle user.

    su - oracle

    Run the following commands to connect the Oracle database as user sysdba.

    sqlplus / as sysdba

NOTE:

The user name and password are required in remote login mode. The following describes how to use the command to connect the system user to the Oracle database with password testpwd.

sqlplus system/testpwd as sysdba

If the following information is displayed, the Oracle database is connected successfully. In the case of a failure, find out the cause as prompted.

SQL>
  • Method 2: Run the following commands to switch to the oracle user.

    su - oracle

    Run the following commands to connect the Oracle database as the system user. Assume that the password of the system user is testpwd.

    sqlplus system/testpwd

    If the following information is displayed, the Oracle database is connected successfully. In the case of a failure, find out the cause as prompted.

    SQL>

startup

This topic describes the startup command for starting the Oracle database.

Syntax

startup Parameter

Parameter Description

Parameter

Description

Null

The database is started properly. After the startup command is executed, the instances are started, then the database is installed, and finally the database is started.

force

The database is restarted forcibly. When the database cannot be closed properly, the startup force command is used to close and then start the database.

nomount

Only the instances are started.

mount

The database is installed after the instances are started.

Example

Assume that the user who logs in to the SUSE Linux is the user who manages the Oracle database, namely, oracle.

On the command-line interface (CLI), run the following command to connect to the Oracle database.

sqlplus / as sysdba

NOTE:
  • The user name and password are required in remote login mode. The following describes how to use the command to connect the system user to the Oracle database with password testpwd.

    $ sqlplus system/testpwd as sysdba

  • For information on how to use the sqlplus command, see 1.1.1 .

Run the startup command to start the Oracle database.

startup

After the command is successfully executed, the following information is displayed:

ORACLE instance started. 
Total System Global Area 1610612736 bytes 
Fixed Size 2046264 bytes 
Variable Size 385877704 bytes 
Database Buffers 1207959552 bytes 
Redo Buffers 14729216 bytes 
Database mounted. 
Database opened.     

ORACLE instance started, Database mounted, and Database opened indicate that the Oracle database is started properly.

shutdown

This topic describes the shutdown command for shutting down the Oracle database.

Syntax

shutdown Parameter

Parameter Description

Parameter

Description

normal

Closes the database, uninstalls the database, and closes the instances after all users are disconnected.

immediate (recommended)

Rolls back all user transactions, and then closes the database, uninstalls the database, and closes the instances.

transactional

Closes the database, uninstalls the database, and closes the instances when all user transactions end.

abort

Terminates the instances immediately. Ongoing user transactions are restored at next start.

NOTE:

The abort parameter is used when the database cannot be closed properly. The use of this parameter may lead to data loss.

Example

Assume that the user who logs in to the SUSE Linux is the user who manages the Oracle database, namely, oracle.

On the command-line interface (CLI), run the following command to connect to the Oracle database.

sqlplus / as sysdba

NOTE:
  • The user name and password are required in remote login mode. The following describes how to use the command to connect the system user to the Oracle database with password testpwd.

    $ sqlplus system/testpwd as sysdba

  • For information on how to use the sqlplus command, see 1.1.1 .

Run the shutdown command to close the Oracle database.

shutdown immediate

After the command is successfully executed, the following information is displayed:

Database closed. 
Database dismounted. 
ORACLE instance shut down.     

Database closed indicates that the Oracle database is closed successfully. Database dismounted indicates that the database is uninstalled successfully. ORACLE instance shut down indicates that the database instances are closed successfully.

show

This topic describes the show command for viewing the operating parameters of the Oracle database.

Syntax

show parameter parameter

Parameter Description

Parameter

Description

Null

Lists all operating parameters of the Oracle database, such as NAME (parameter name), TYPE (parameter type), and VALUE (parameter value).

Parameter

Shows the value of the specified parameter.

Example
  • Assume that the user who logs in to the SUSE Linux is the user who manages the Oracle database, namely, oracle.

    This example describes how to view all operating parameters of the Oracle database.

    On the command line interface (CLI), run the following command to connect to the Oracle database.

    sqlplus / as sysdba

NOTE:
  • The user name and password are required in remote login mode. The following describes how to use the command to connect the system user to the Oracle database with password testpwd.

    $ sqlplus system/testpwd as sysdba

  • For information on how to use the sqlplus command, see 1.1.1 .

Run the show command to view all operating parameters of the Oracle database.

show parameter

The following is part of the output information.

NAME TYPE VALUE 
------------------------------------ ----------- ------------------------------ 
undo_management string AUTO 
undo_retention integer 900 
undo_tablespace string UNDOTBS1 
use_indirect_data_buffers boolean FALSE 
user_dump_dest string /opt/oracle/oradb/home/admin/i 
mapdb/udump 
utl_file_dir string 
workarea_size_policy string AUTO     
  • Assume that the user who logs in to the SUSE Linux is the user who manages the Oracle database, namely, oracle.

    This example describes how to view the value of the processes parameter.

    On the CLI, run the following command to connect to the Oracle database.

    sqlplus / as sysdba

    Run the show command to view the operating parameters of the Oracle database.

    show parameter process

    The information about the parameters containing processes is displayed.

    NAME TYPE VALUE 
    ------------------------------------ ----------- ------------------------------ 
    aq_tm_processes integer 0 
    db_writer_processes integer 1 
    gcs_server_processes integer 0 
    job_queue_processes integer 10 
    log_archive_max_processes integer 2 
    processes integer 150     

alter

This topic describes the alter command for modifying the operating parameters of the Oracle database.

Syntax

alter Option 1 Parameter 1 Option 2 Parameter 2……

Parameter Description

Parameter

Description

user

Sets the password of an Oracle database user.

NOTE:

The example in this topic only describes how to change the password of an Oracle user. For details about parameter settings, see related documents provided by the Oracle company.

system set

Sets the system parameters of the Oracle database.

NOTE:

The example in this topic only describes how to modify the system parameters of the Oracle database. Parameter values are selected based on actual applications. This example is only for reference. For details about parameter settings, see the related documents provided by the Oracle company.

Example
  • Assume that the user who logs in to the SUSE Linux is the user who manages the Oracle database, namely, oracle.

    On the command line interface (CLI), run the following command to connect to the Oracle database:

    sqlplus / as sysdba

NOTE:
  • The user name and password are required in remote login mode. The following describes how to use the command to connect the system user to the Oracle database with password testpwd.

    $ sqlplus system/testpwd as sysdba

  • For information on how to use the sqlplus command, see 1.1.1 .

Run the following command to change the password of the database user system:

alter user system identified by "testpwd";

To be specific, system is the database user name to be changed, and testpwd is the password of the user-defined system user.

If the return value is User altered, the password is successfully changed. Otherwise, locate the cause as prompted.

  • Assume that the user who logs in to the SUSE Linux is the user who manages the Oracle database, namely, oracle.

    Initialization operating parameter processes: set the number of processes for connecting to the Oracle database instance is 1024.

    On the CLI, run the following command to connect to the Oracle database:

    sqlplus / as sysdba

    Run the following command to modify the operating parameters of the Oracle database:

    alter system set processes=1024 scope=spfile;

    To be specific, processes is the name of the operating parameter to be modified, and scope=spfile indicates that processes is the initialization parameter of the Oracle database. See 1.1.4 to view the current value of processes.

    If the return value is System altered, the password is successfully changed. Otherwise, locate the cause as prompted.

Translation
Download
Updated: 2019-08-03

Document ID: EDOC1100044373

Views: 26737

Downloads: 84

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next