Friday 10 January 2014

How To Create a Table in a Specific Tablespace?

SQL> alter user scott account unlock;

User altered.

SQL> alter user scott identified by tiger;

User altered.

SQL> conn scott/tiger
Connected.
SQL> select count(*) from emp;

  COUNT(*)
----------
        14

SQL> CREATE TABLE image_emp TABLESPACE abdulwasiq as select * from emp;

Table created.

SQL> SELECT table_name,tablespace_name, num_rows FROM USER_TABLES WHERE tablespace_name in ('USERS', 'ABDULWASIQ');

TABLE_NAME                     TABLESPACE_NAME             NUM_ROWS
------------------------------ ------------------------- ----------
SALGRADE                       USERS                              5
BONUS                          USERS                              0
EMP                            USERS                             14
DEPT                           USERS                              4
IMAGE_EMP                      ABDULWASIQ

SQL>

No comments:

Post a Comment