我想在oracle中创建一个新模式,我使用了示例代码,可用于
here
CREATE SCHEMA AUTHORIZATION oe CREATE TABLE new_product (color VARCHAR2(10) PRIMARY KEY,quantity NUMBER) CREATE VIEW new_product_view AS SELECT color,quantity FROM new_product WHERE color = 'RED' GRANT select ON new_product_view TO scott /
但是,得到错误
ERROR at line 1: ORA-02421: missing or invalid schema authorization identifier
另外,请帮我如何列出所有可用架构的名称.我在用
select username from dba_users;
列出模式,但我认为,它不是一个正确的方法,因为,用户和模式具有多对多的关系,这意味着我无法在此获取所有模式名称.
请帮我 !!
来自oracle
documentation:
This statement does not actually create a schema. Oracle Database
automatically creates a schema when you create a user
所以你首先需要使用模式名称create a User
更新:我现在无法真正测试它,但应该是这样的:
CREATE USER oe IDENTIFIED BY oePSWRD; CREATE SCHEMA AUTHORIZATION oe CREATE TABLE new_product (color VARCHAR2(10) PRIMARY KEY,quantity FROM new_product WHERE color = 'RED' GRANT select ON new_product_view TO scott;