Oracle creation, deletion, import, and export Command Line Summary (1)

Source: Internet
Author: User

The password entered during database creation is to change the default password of the system, the password you need to enter when logging on with the system, sysman, and other system default identities is the modified password (the password entered when you create a database)

To create a new user, you must log on to the system or sysman (the two have the maximum permissions) before creating a new user.

Create user format: create user username identified by password (for example, create user cht identified by cht ;)

After creation, you must assign permissions. Otherwise, you cannot connect to the database or sqlplus.

Therefore, grant connect, resource, dba to cht; then the database can be connected through cht/cht. The select, update, delete, and insert permissions do not need to be assigned, because each user has these basic permissions by default.

How to connect to a database using the command line method:

Start = run = cmd

Method 1:

Enter sqlplus and press Enter.

Enter the User name: system, and press Enter.

Enter the password orcl and press Enter.

Method 2:

Enter sqlplus system/orcl @ orcl, and press enter (system is the username, orcl is the password, and @ is the library name)

(After the database is installed, there are two system-level users:

1) the default system password is manager.

2) sys default password: change_on_install)

You must create a temporary tablespace and a data table space before creating a user. Otherwise, the default system tablespace is not good.

// Create a temporary tablespace

Create temporary tablespace zfmi_temp tempfile 'd: \ oracle \ oradata \ zfmi \ zfmi_temp.dbf 'size 100 m autoextend on next 32 m maxsize 2048 m extent management local;

Note:

1. Name of zfmi_temp tablespace

2. D: \ oracle \ oradata \ zfmi \ The place where the database files are stored. Generally, it is the folder of control files, data files and log files after the database is installed, add the name of the tablespace to be created + dbf (data file)

3. initial size of the 100 M tablespace

4. The size of 32 MB tablespace automatically increases

5. Maximum tablespace size of 2048 MB

// Create a data table space

Create tablespace zfmi logging datafile 'd: \ oracle \ oradata \ zfmi. dbf' size 100 m autoextend on next 32 m maxsize 2048 m extent management local;

// Create a user and specify the tablespace

Create user zfmi identified by zfmi default tablespace zfmi temporary tablespace zfmi_temp;

// Grant permissions to users

Grant connect, resource dba to zfmi; (dba: Specify all permissions)

This step completes the creation of a user.

// Delete the user and all objects of the user

Drop user zfmi cascade;

// The cascade parameter is used to cascade the deletion of all objects of the user. if the user has an object but does not add this parameter, the user cannot delete it. Therefore, this parameter is habitually added.

// Delete the tablespace

Prerequisites: before deleting a tablespace, make sure that the tablespace is not used by other users before deleting it.


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.