Create Oracle tablespace using sqlplus

  • Log in   

    Enter the following command in the dos window: sqlplus Press Enter to prompt for the user name - that is, the user name when creating the database instance, enter the user name: sys as sysdba

Password.........Enter to log in

  • View data file location

    Next, let's take a look at where your current database files are generally placed:

  select  name  from  v$datafile;

  The results you may see under windows are as follows:

  SQL> select name from v$datafile;

  NAME

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

  D:/oracle/product/10.2.0/oradata/orcl/system01.dbf

  D:/oracle/product/10.2.0/oradata/orcl/undotbs01.dbf

  It means that your data files are placed in the directory D:/oracle//oradata/orcl/

  The results you may see under Linux are as follows:

  SQL> select name from v$datafile;

  NAME

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

  /oracle/product/10.2.0/oradata/orcl/system01.dbf

  /oracle/product/10.2.0/oradata/orcl/undotbs01.dbf

  It means that your data files are placed in the directory /oracle/oradata/orcl/

  • Create tablespace

   We can start creating database tablespaces. Tablespace name: ATMV

    Drop tablespace and all contents in
    tablespace drop tablespace ATMV INCLUDING CONTENTS;
    create tablespace, specify data file, initialize 100M and increase by 50M

    windows:
    create tablespace ATMV datafile 'D:/oracle/product/10.2.0/oradata/orcl/ATMV.dbf' size 100m autoextend on next 50m maxsize unlimited;

    Linux:

    create tablespace ATMV datafile '/oracle/product/10.2.0/oradata/orcl/ATMV.dbf' size 100m autoextend on next 50m maxsize unlimited;

  • create user

    Next we start to create a user, username ca, password ps

    Delete the user and all objects under the user, pay attention to the keyword cascade

    drop user ca cascade;

    Create user:

  create  user  ca  identified   by   ps  default   tablespace  ATMV;

  • Modify user permissions

  grant role1, role2 to username;

  An example is as follows:

  grant   dba, connect    to   wbppcs;

  For specific user permission issues, please refer to the permission rules Personal learning records

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326218512&siteId=291194637