How to connect to particular database in Oracle 10g
Suppose I have multiple Oracle databases in the same server. Now I want to connect to particular database and query a table just like SQL Server 2008. How to start particular Oracle 开发者_如何转开发database?
If you are using SQL*Plus, the most common syntax for opening a connection is
sqlplus user_name/password@tns_alias
In this example TNS_ALIAS
is the TNS alias for the particular database you want to connect to (most likely "XE" based on your followups to inium's answer). If you want to connect to a different database, you would need to specify a TNS alias for that specific database.
Note that since you are coming from a SQL Server background, the SQL Server definition of a database is rather different than the Oracle definition. What SQL Server calls a database is similar logically to what Oracle calls a schema (and similar physically to what Oracle calls a tablespace). So when you're dealing with Oracle, it's much more common to have many schemas in a single database than to have a large number of databases on a server. This is particularly true if you're using the Express Edition (Oracle XE) where you're generally limited to one database per machine.
go to cmd and type sqlplus <database-name>/<database-password>
You can use SQL Developer, it's similar to SQL Enterprise Manager 2005. Just create a new connection using the db user name and password.
精彩评论