在 SQL PLUS ORACLE 11gr1 上使用 DATABASE 命令
在Windows7 32位平台成功安装ORACLE 11gR1后,我可以进入SQL PLUS,也可以创建数据库,但我仍然不知道如何使用数据库.
After successfully installing ORACLE 11gR1 on Windows7 32bit platform, I can go inside the SQL PLUS and I can also create database, but I still don't have any clue how to use database.
在 MySQL 中使用数据库的命令应该是:
in MySQL the command to use database should be:
USE MYDATBASENAME;
在SQL SERVER中也大同小异:
In SQL SERVER also quite the same:
USE [DATABASE];
但是我不知道如何通过 SQLPLUS 在 ORACLE 11gR1 中使用数据库,任何人有任何想法吗?
But I have no idea how to use database in ORACLE 11gR1 via SQLPLUS, any body have any ideas?
我打算在成功使用 USE
命令后创建一个表.
I'm planning to create a table after I succeed in using the USE
command.
推荐答案
尽管它们都使用相同的名词,但术语数据库"在 MySQL (SQL Server) 和 Oracle 之间是完全不同的.
Even though they all use the same noun the term "database" is something completely different between MySQL (SQL Server) and Oracle.
通常将 MySQL 数据库映射到 Oracle 中的架构/用户.在 Oracle 中,模式和用户之间存在 1:1 的关系.
Usually a MySQL database is mapped to a schema/user in Oracle. In Oracle there is a 1:1 relationship between schemas and users.
Oracle 中的数据库"是指完整安装(也称为实例").由于通常只有一个实例/安装,因此在 Oracle 中切换数据库"是没有意义的.
A "database" in Oracle refers to the complete installation (which is also named "instance"). As there is typically only a single instance/installation there is no sense in "switching a database" in Oracle.
在 Oracle 中最接近使用 mydatabase"的是切换当前模式:
The closest thing to "USE mydatabase" in Oracle would be to switch the current schema:
ALTER SESSION SET current_schema = other_user;
然后您可以访问other_user
的所有表而无需为它们添加前缀.这当然要求您的当前用户至少对其他用户的表(即架构)具有选择权限
Then you can access all tables of other_user
without prefixing them. This of course requires your current user to have at least select privileges on the tables of the other user (i.e schema)
相关文章