在SQL PLUS ORACLE 11gr1上使用USE DATABASE命令 [英] USE DATABASE command on SQL PLUS ORACLE 11gr1

查看:143
本文介绍了在SQL PLUS ORACLE 11gr1上使用USE 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中与"USE 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)

这篇关于在SQL PLUS ORACLE 11gr1上使用USE DATABASE命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆