In the process of creating a complete database from the Oracle database file, first create an ORACLE database locally. I have written the global database name and SID to SCHOOL.
In the process of creating a complete database from the Oracle database file, first create an ORACLE database locally. I have written the global database name and SID to SCHOOL.
Recently, I helped my teacher write some functions of the website management system. Because they are not in the same place, the teacher sent me a library file (subsequently named. dmp), I want to build a database and run it on my own. Next I will talk about the steps I have done so as not to forget when I need them.
1. First, create an Oracle database locally. I have written the global database name and SID to SCHOOL.
2. log on to the database as an administrator. I use SYSTEM and the password is the password set during database creation.
3. After you log on to the database using PL/SQL, you can create a user. The Code is as follows:
Create user myxuser identified by myxuser;
You can also change the Database Password: alter user zzg identified by unis;
4. By default, after a user is created, the system will assign a tablespace (users) to the user by default. We can use the following statement to view the tablespace where all users are located:
Select username, default_tablespace from dba_users;
Generally, we do not use the user's default tablespace. In this case, we can create a tablespace ourselves:
Create tablespace myxuser_data datafile 'e: \ myxuser. dbf 'size 200 M; tablespace is followed by the name of the tablespace; datafile is followed by the physical storage path of the tablespace; the file suffix can be obtained at will;
The size of a tablespace is MB.
5. Create a tablespace and allocate it to the user: alter user myxuser default tablespace myxuser_data;
6. Assign permissions to myxuser: grant create session, create table, create view, create sequence, unlimited tablespace to myxuser;
7. In this way, the user myxuser can log on. Import the. dmp file to the database: imp myxuser/myxuser @ SCHOOL file = E: \ school20130120.dmp fromuser = myxuser touser = myxuser
Here, there is a small problem. An error occurs: IMP-00013. only DBA can import files exported by other DBAs. Therefore, we need to grant the DBA permission to the user myxuser:
Grant dba to myxuser;
So far, we have found that some tables have been imported to the database,
Because the tablespace size I allocated to myxuser is 200 MB, but there are many library files, so I only imported some tables, so the tablespace size should be expanded automatically:
Alter database datafile 'e: \ MYXUSER. dbf' autoextend on next 200 M; // automatically increase by 200 M each time
So far, the import is successful.