About SQL and SQL-Based Management Tools
2010-01-10 20:44
477 查看
About SQL and SQL-Based Management Tools
To perform many of its operations, Oracle Enterprise Manager Database Control (Database Control) submits structured query language (SQL) statements to the database. SQL (pronounced like sequel) is an industry-standard English-like computer programming language for querying and updating databases.为执行许多的操作,数据库控制台向数据库提交sql语句。sql语句是一个为查询或更新数据库的英语化的工业标准计算机编程语言。
The following is an example of a SQL query that lists information about countries in a countries table, which is owned by user
hr:
下面是一个sql查询的例子,列出属于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
nickand assigns him a password of your choosing, represented by password:
sql的功能很强大,可以执行各种的数据库管理任务。下面的sql语句创建一个数据库用户nick并且分配一个密码,把密码写在下面password处。
CREATE USER nick IDENTIFIED BY password;
When performing an administrative task in Database Control, you can click Show SQL to see the SQL statements that Database Control generates and submits.
当在控制台执行一个管理任务时,你可以点击 Show SQL,查看控制台生成并提交的sql语句。
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. The following sections provide details:
除了图形化界面的控制台之外,还可以用其它的oracle工具,如SQL Developer和SQL*Plus来发布sql命令。这些工具能让你执行数据库的管理操作,可以直接在数据库中进行增、删、改、查等操作。下面详细讲述:
About SQL*Plus
Starting SQL*Plus and Connecting to the Database
About SQL Developer
See Also:
Oracle Database 2 Day Developer's Guide
Oracle Database SQL Language Reference
About SQL*Plus
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 yourOracle_home[/code]
/bindirectory.
SQL*Plus是一个命令行程序用来向oracle数据库提交sql和PL/SQL语句的。你可以交互式的提交语句,或者写成SQL*Plus脚本。SQL*Plus程序和数据库一起安装,路径在
Oracle_home/bin。
You can start SQL*Plus from the command line, or on Microsoft Windows, from the Start menu.
你可以从命令行启动SQL*Plus,或者在Windows系统从开始菜单启动。
When SQL*Plus loads, it issues the SQL prompt, which looks like this:
当SQL*Plus加载的时候,会出现像这样的SQL提示:
SQL>
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.
在sql提示行,可以输入执行管理任务的语句,如关闭数据库或者创建新用户或增、删、改查数据等。
You can enter a single SQL statement on multiple lines. You must end each statement with a semicolon (;). For most statements, you can rerun a statement by entering a forward slash (/) on a line by itself.
可以把一个sql语句写在多行中。每条语句要以分号(;)结尾。大部分语句都可以用“/”重复执行。
See Also:
SQL*Plus User's Guide and Reference
Starting SQL*Plus and Connecting to the Database
The section describes how to start SQL*Plus and connect to the database from both the command line and the Windows start menu.To start SQL*Plus and connect to the database from the command line:
Open a command window.
(Linux and UNIX systems only) Set the required environment variables (
ORACLE_HOMEand
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/bindirectory. They may prompt you for the desired value of the
ORACLE_SIDenvironment 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.
(Linux and UNIX systems only) Either ensure that the
Oracle_home[/code]
/bindirectory is in your
PATHenvironment variable, or change to the
Oracle_home[/code]
/bindirectory.
Enter the following command:
sqlplus {username | /} [as sysdba] Enter password: password
SQL*Plus connects you to the default database instance (Microsoft Windows) or the database instance specified by the environment variables (Linux and UNIX).
For
username, you can use the
SYSor
SYSTEMadministrative users. At the prompt, enter the password that you set up during installation. If you use the
SYSuser, you must include
as sysdbaafter the username.
When you enter
SYSor a slash (
/) as the user name and provide the
as
sysdbaclause, you are authenticating using operating system authentication. Operating system authentication uses your Windows, UNIX, or Linux host user account to authenticate you to Oracle Database. You must have logged in to the host computer with a user account that is a member of a special host user group. On UNIX and Linux, this user group is typically
dba. This type of authentication enables you to connect to an Oracle database that is not yet started, so that you can start it up. See Oracle Database Administrator's Guide for more information.
To start SQL*Plus and connect to the database from the Windows Start menu:
Click Start, select Programs (or All Programs), then Oracle - HOME_NAME, then Application Development, and then SQL*Plus.
When prompted, enter the user name and password for the account that you want to use to connect to the database.
For the user name, you can use the
SYSor
SYSTEMadministrative accounts, and you can use the password that you set up during installation.
If you use
SYSor
/as the user name, follow them with a space and then the clause
as
sysdba, as shown in the following examples:
Enter user-name: sys as sysdba Enter password: password or Enter user-name: / as sysdba
When you enter
SYSor a slash (
/) as the user name and provide the
as
sysdbaclause, you are authenticating using operating system authentication. Operating system authentication uses your Windows, UNIX, or Linux host user account to authenticate you to Oracle Database. You must have logged in to the host computer with a user account that is a member of a special host user group. On UNIX and Linux, this user group is typically
dbafor the sysdba privilege. This type of authentication enables you to connect to an Oracle database that is not yet started, so that you can start it up. See Oracle Database Administrator's Guide for more information.
See Also:
"About Administrative Accounts and Privileges"
SQL*Plus User's Guide and Reference
Oracle Database SQL Language Reference
About SQL Developer
SQL Developer provides another graphical user interface for accessing your 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.
See Also:
Oracle Database 2 Day Developer's Guide for instructions for starting SQL Developer
相关文章推荐
- About SQL and SQL-Based Management Tools
- About SQL and SQL-Based Management Tools
- 《Microsoft Sql server 2008 Internal》读书笔记--第六章Indexes:Internals and Management(10)
- 《Microsoft Sql server 2008 Internals》读书笔记--第六章Indexes:Internals and Management(1)
- 《Microsoft Sql server 2008 Internals》读书笔记--第六章Indexes:Internals and Management(2)
- 《Microsoft Sql server 2008 Internals》读书笔记--第六章Indexes:Internals and Management(3)
- About UML Tutorial and Tools
- An Introduction to Dynamic Management Views and Functions in SQL Server 2005
- Known issue about configuring BAM Portal and WSS based on different IIS versions
- 《Microsoft Sql server 2008 Internals》读书笔记--第六章Indexes:Internals and Management(9)
- Effective C#之Item 48:Learn About Tools and Resources
- Data Management and Data Management Tools
- 《Microsoft Sql server 2008 Internal》读书笔记--第六章Indexes:Internals and Management(10)
- 《Microsoft Sql server 2008 Internals》读书笔记--第六章Indexes:Internals and Management(3)
- Tools.InstallCommunityControls错误都是因为安装了SQL Server Management Studio Express CTP
- JDK Tools and Utilities---Java Troubleshooting, Profiling, Monitoring and Management Tools
- Open source and free log analysis and log management tools.
- 《Microsoft Sql server 2008 Internals》读书笔记--第六章Indexes:Internals and Management(8)
- How do adaptive cursor sharing and SQL Plan Management interact?
- 《Microsoft Sql server 2008 Internals》读书笔记--第六章Indexes:Internals and Management(4)