Creating a database in Oracle 12c on Linux is a straightforward process that involves several steps. Here's a detailed guide:
1. Login as Oracle User
- Log in to your Linux system as the Oracle user. This user has the necessary permissions to create databases.
2. Start SQL*Plus
- Open a terminal window and navigate to the Oracle 12c installation directory.
- Execute the command:
sqlplus /nolog
3. Connect to the Database
- Use the
CONNECT
command to connect to the database as the SYSDBA user. This user has the highest privileges and can perform all database operations. - Example:
CONNECT / AS SYSDBA
4. Create the Database
- Use the
CREATE DATABASE
command to create a new database. Specify the database name, location, and character set. - Example:
CREATE DATABASE my_database DATAFILE '/u01/app/oracle/oradata/my_database/system01.dbf' SIZE 100M AUTOEXTEND ON NEXT 10M MAXSIZE 2048M LOGFILE GROUP 1 ('/u01/app/oracle/oradata/my_database/redo01.log' SIZE 50M) CHARACTER SET AL32UTF8;
5. Create User Accounts
- Create user accounts with appropriate privileges using the
CREATE USER
command. - Example:
CREATE USER my_user IDENTIFIED BY "MyPassword"; GRANT CONNECT, RESOURCE TO my_user;
6. Start the Database
- Use the
STARTUP
command to start the newly created database. - Example:
STARTUP
7. Connect to the Database as a User
- Use the
CONNECT
command to connect to the database as a user you created. - Example:
CONNECT my_user/MyPassword
8. Verify the Database
- Use the
SELECT * FROM V$DATABASE;
command to verify the database details.
9. Create Tables and Other Objects
- Once connected to the database, you can create tables, views, procedures, and other database objects using SQL commands.
Conclusion
By following these steps, you can successfully create a new database in Oracle 12c on Linux. Remember to adjust the commands and parameters based on your specific requirements.