The process of creating a complete database from an Oracle database file

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.