How to Create a database and a user in oracle
Mysql and SQL server are widely used in the project development process, while oracle is rarely used. mysql and SQL server are similar in use, mysql and sqlserver can directly create a database by using the create database "database Name", while oracle requires the database to correspond to the user's meaning when creating a database, follow these steps to create an oracle database:
Create two database files
Create a ing between the user and the file created above
Add permissions to users
1. Create two database files (monitor. dbf and monitor_temp.dbf)
Copy codeThe Code is as follows:
Create tablespace monitor logging datafile 'e: \ app \ owner \ oradata \ orcl \ monitor. dbf'
SIZE 100 m autoextend on next 32 m maxsize 500 m extent management local;
Copy codeThe Code is as follows:
Create temporary tablespace monitor_temp tempfile 'e: \ app \ owner \ oradata \ orcl \ monitor_temp.dbf'
Size 100 m autoextend on next 32 m maxsize 500 m extent management local;
2. Create a ing between the user and the file created above (the user name is monitor and the password is monitor)
Copy codeThe Code is as follows:
Create user monitor identified by monitor default tablespace monitor temporary tablespace monitor_temp;
3. Add Permissions
Copy codeThe Code is as follows:
Grant connect, resource, dba to monitor;
Grant create session to monitor;
Sometimes database deletion and user deletion are also used. The delete statement is also provided here.
4. delete a database
Copy codeThe Code is as follows:
Drop tablespace monitor including contents and datafiles;
5. delete a user
Copy codeThe Code is as follows:
Drop user monitor cascade;
You can create an oracle database and a user based on the preceding steps.