Oracle DBMS 12c,如何创建可以创建表的用户

时间:2016-06-06 22:44:44

标签: database oracle

我在我的系统上安装了Oracle 12c,打算开发一些简单的表。如何创建可以创建和操作表的简单用户?现在,我可以访问dbms的唯一方法是使用sqlplus" / as sysdba"。

我创建了一个表空间。但是当我尝试使用该表空间创建一个默认的用户时,它告诉我表空间不存在。我运行"从V $ tablespace"中选择*我确实看到了我的表空间。

我觉得我在这里缺少一些基本的东西。我一直在阅读Oracle的文档,似乎没什么用。特别是,用户创建。 Oracle的示例导致我出错,抱怨可插拔数据库。阅读后,可插拔数据库是12c的新功能,因此您必须将C ##附加到前端用户名。我认为这使它成为一种常见的'用户,虽然我不确定那是什么。无论如何,即使使用" C ## test"它无法找到我的表空间。 :-(

SQL> create tablespace DBClassSpace;

SQL> create user C##test
  2  identified by secret
  3  default tablespace DBCLASSSPACE
  4  quota 10M on DBCLASSSPACE
  5  temporary tablespace TEMP;
create user C##test
*
ERROR at line 1:
ORA-65048: error encountered when processing the current DDL statement in
pluggable database PLUGDBCLASS
ORA-00959: tablespace 'DBCLASSSPACE' does not exist

SQL> select user from dual;

USER
------------------------------
SYS

SQL> select * from V$tablespace;

       TS# NAME                           INC BIG FLA ENC     CON_ID
---------- ------------------------------ --- --- --- --- ----------
         1 SYSAUX                         YES NO  YES              1
         0 SYSTEM                         YES NO  YES              1
         2 UNDOTBS1                       YES NO  YES              1
         4 USERS                          YES NO  YES              1
         3 TEMP                           NO  NO  YES              1
         0 SYSTEM                         YES NO  YES              2
         1 SYSAUX                         YES NO  YES              2
         2 TEMP                           NO  NO  YES              2
         0 SYSTEM                         YES NO  YES              3
         1 SYSAUX                         YES NO  YES              3
         2 TEMP                           NO  NO  YES              3

       TS# NAME                           INC BIG FLA ENC     CON_ID
---------- ------------------------------ --- --- --- --- ----------
         3 USERS                          YES NO  YES              3
         5 DBCLASSSPACE                   YES NO  YES              1

...

SQL> select tablespace_name from cdb_tablespaces;   

 TABLESPACE_NAME
    ------------------------------
    SYSTEM
    SYSAUX
    UNDOTBS1
    TEMP
    USERS
    DBCLASSSPACE
    SYSTEM
    SYSAUX
    TEMP
    USERS

    10 rows selected.

    SQL> create user C##test
      2  identified by secret
      3  default tablespace DBCLASSSPACE
      4  quota 10M on DBCLASSSPACE
      5  temporary tablespace TEMP;
    create user C##test
    *
    ERROR at line 1:
    ORA-65048: error encountered when processing the current DDL statement in
    pluggable database PLUGDBCLASS
    ORA-00959: tablespace 'DBCLASSSPACE' does not exist

1 个答案:

答案 0 :(得分:0)

您需要在表空间中指定一些卷,以便用户创建表。 如果你在cdb $ root:

loopCounter = 1
With DoCmd
    .SetWarnings False
    For Each Fil In fld.Files
            'I'm assuming the new field that will hold the FileName
            'doesn't exist as part of the original table so we
            'are going to create it for the first file read in
        If loopCounter = 1 Then CurrentDb.Execute ("Alter Table MyTable Add Column MyNewField Text")

        If UCase(Right(Fil.Name, 3)) = "CSV" Then
            .TransferText acImportDelim, , DestTable, Fil.Path, False
            CurrentDb.Execute ("Update MyTable Set MyNewField = '" & Fil.Name & "' where MyNewField is null")
        End If

        loopCounter = loopCounter + 1
    Next
    .SetWarnings True
End With