After Oracle is installed, there is a default database. In addition to this default database, we can also create our own database.
To avoid the trouble, you can use the 'database Configuration Assistant 'Wizard to create a Database, an error will occur when creating the tablespace-I spent a few hours here, Dizzy ).
After creating a database, you cannot create tables in the database immediately. You must first create a user for the database and specify a tablespace for the user.
The procedure for creating a database user is as follows:
1. if a database named 'test' has been created, the test directory already exists under the d: \ oracle \ oradata \ directory (Note: My Oracle11g is installed under d: \ oracle, if your Oracle is installed in another directory, the new database directory is under * \ oradata ).
2. Before creating a user, create a tablespace:
The format is: Format: create tablespace table name datafile 'data filename 'size tablespace size;
For example, SQL> create tablespace test_tablespace datafile 'd: \ oracle \ oradata \ test. dbf' size 100 M;
Specifically, 'test _ tablespace' is your custom tablespace name, which can be any name;
'D: \ oracle \ oradata \ test. dbf 'is the storage location of the data file, and the 'test. dbf' file name is also arbitrary;
'Size 100m' indicates the size of the data file, that is, the size of the tablespace.
Delete a namespace
Drop tablespace test including contents and datafiles cascade constraints;
3. Now the tablespace named 'test _ tablespace 'has been created, and the user can be created below:
The format is: Format: create user name identified by password default tablespace table;
For example, SQL> create user testone identified by testone default tablespace test_tablespace;
The default tablespace 'default tablespace' uses the tablespace created above.
4. Authorize the new user:
SQL> grant connect, resource to testone;-grant connect and resource permissions to testone users
SQL> grant dba to testone;-grant the dba permission to the testone user.
OK! The database user has been created. Now you can use this user to create a data table!