载入中
自定义HTML载入中... loading
Oracle 11g DBA:About SQL and SQL-Based Management Tools [转贴 2007-11-05 23:19:16]  删除... 
字体变小 字体变大

Many of the operations performed by Oracle Enterprise Manager Database Control (Database Control) use structured query language (SQL) statements. SQL (pronounced like sequel) is an industry-standard English-like computer programming language for querying and updating databases.

The following is an example of a SQL query that lists information about countries in a countries table, which is owned by user hr:

SELECT COUNTRY_ID, COUNTRY_NAME FROM HR.COUNTRIES;

SQL is a powerful language that can also be used to perform a variety of database administration tasks. The following SQL statement creates the database user nick and assigns him the password firesign:

CREATE USER nick IDENTIFIED BY firesign;

When performing an administrative task in Database Control, you can click Show SQL to see the SQL statements being issued.

In addition to using the graphical management pages presented in Database Control, you can use other Oracle tools such as SQL Developer and SQL*Plus to issue SQL statements. These tools enable you to perform database management operations, and to query, insert, update, or delete data directly in the database.

Starting SQL*Plus and Connecting to the Database

SQL*Plus is a command-line program that you use to submit SQL and PL/SQL statements to an Oracle database. You can submit statements interactively or as SQL*Plus scripts. SQL*Plus is installed with the database and is located in your Oracle_home/bin directory.

You can start SQL*Plus from the command line, or on Microsoft Windows, from the Start menu.

To start SQL*Plus and connect to the database from the command line:

  1. Open a command window.

  2. (Linux and UNIX systems only) Set the required environment variables (ORACLE_HOME and ORACLE_SID) by running the script oraenv (for the Bourne, Korn, or Bash shell) or coraenv (for the C shell).

    These scripts are typically located in the /usr/local/bin directory. They may prompt you for the desired value of the ORACLE_SID environment variable. If so, supply the system ID (SID) that you chose when you installed Oracle Database. The default SID that the installer typically suggests is orcl.

  3. (Linux and UNIX systems only) Either ensure that the Oracle_home/bin directory is in your PATH environment variable, or change to the Oracle_home/bin directory.

  4. Enter the following command:

    sqlplus username/password [as sysdba]
        

    For username, you can use the SYS or SYSTEM administrative users and the password that you set up during installation. If you use the SYS user, you must include as sysdba in the command line.

    SQL*Plus starts and connects you to the default database instance (Microsoft Windows) or the database instance specified by the environment variables (Linux and UNIX systems).

To start SQL*Plus and connect to the database from the Start menu (Microsoft Windows):

  1. Click Start.

  2. From the Start menu, select Programs (or All Programs), then select Oracle_home, and then select Application Development.

  3. Select SQL*Plus.

  4. Enter values in the User Name and Password fields for the account you want to use to connect to the database. Then click OK.

    For the user name, you can use the SYS or SYSTEM administrative account, and you can use the password that you set up during installation. If you use the SYS account, enter the password in the Password field, then a space, and then the SQL clause as sysdba.

    When SQL*Plus loads, it issues the SQL prompt, which looks like this:

    SQL>
        
  5. At the SQL prompt, you can enter statements that perform administrative tasks such as shutting down the database or creating a new user, or you can query, insert, update, and delete data.

    You can enter a single SQL statement on multiple lines. You must end each statement with a semicolon (;).

About SQL Developer

SQL Developer is a graphical user interface for accessing your instance of Oracle Database. SQL Developer supports development in both the SQL and PL/SQL languages. It is available in the default installation of Oracle Database.

With SQL Developer, you can browse database objects, run SQL statements and SQL scripts, and edit and debug PL/SQL statements. You can also run any number of provided reports, as well as create and save your own.

 〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓

了解如何利用Google广告让您的网站产生收益,请点击下面连接:

手把手教您注册 GoogleAdsense赚美元

所属版块: 科技
票数:
什么是“我顶”?
点击数:    评论数:
本文章引用通告地址(TrackBack Ping URL)为:
本文章尚未被引用。
发表评论
大 名:
(不填写则显示为匿名者)
网 址:
(您的网址,可以不填)
标 题:
内 容:
请根据下图中的字符输入验证码:
(您的评论将有可能审核后才能发表)
和讯个人门户 v1.0 | 和讯部落 | 客服中心