Creating a schema

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Osiris Dragon
    New Member
    • Aug 2011
    • 10

    Creating a schema

    I am trying to create a schema using SYS as SYSDBA account.

    Code:
    create schema authorization testschema
    create table timsheet(tid INTEGER PRIMARY KEY)


    Error at Command Line:1 Column:0
    Error report:
    SQL Error: ORA-02421: missing or invalid schema authorization identifier
    02421. 00000 - "missing or invalid schema authorization identifier"
    *Cause: the schema name is missing or is incorrect in an authorization
    clause of a create schema statement.
    *Action: If the name is present, it must be the same as the current
    schema.




    -----------------------


    I can't see what I am doing wrong. I googled around and see some places people create an new user account just prior to creating a schema like above. When I tried it like that it worked.

    So does it mean that everytime I want to create a schema, I have to create a new account? It doesn't seem right.

    Cheers all for looking at it.
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    See here


    schema

    Specify the name of the schema. The schema name must be the same as your Oracle Database username.

    Comment

    • Osiris Dragon
      New Member
      • Aug 2011
      • 10

      #3
      Thanks. I missed the part

      This statement does not actually create a schema. Oracle Database automatically creates a schema when you create a user (see CREATE USER ).


      when I first read the documentation on how to create a schema.

      But its just seems bizarre. if it does not create a schema, isn't the clause "create schema" a bit misleading? Besides if I wanted to create tables, I could just do so with CREATE TABLE so bit unsure whats the purpose of this statement is since schema is created for every CREATE USER.

      Comment

      Working...