Pl/SQL perform simple operations on oracle10

Source: Internet
Author: User

To facilitate future query, perform the following operations on oracle in PL/SQL:

1. Use the ORACLE tool config assisstant to create a database. different operating systems or character sets are required. If yes, check the database character set.

2. Set the password of sys and system, enter pl/SQL, and connect to the created database instance. name tian

3. Open an SQL window and create a tablespace:

Create tablespace tian datafile 'C:/oracle/product/10.2.0/oradata/tian/tian_data01.dbf'

Size 500 M

Autoextend on

Next 100 M maxsize unlimited;

1) DATAFILE: path for storing tablespace data files. The path is created in advance.
2) SIZE: initially set to 500 M
3) maxsize unlimited: the maximum value is unlimited. Pay attention to the disk space size. If the increase in data volume exceeds the disk space, the database will be abnormal. 4) the space name tian is not necessarily the same as the data file name, here, add the 01 suffix. 5) autoextend on/OFF indicates that the automatic expansion tablespace is started/stopped. 6) the corresponding alter drop tablespace is not described.

4. Create a user,

Create user tianuser identified by tianuser

Default tablespace tian

Temporary tablespace temp;

1) The user's tianuser password is tianuser. the first character of the password may be a character and cannot be a number.

2) Specify the tablespace tian

3) specify temporary tablespace temp

5. Then, assign permissions to the newly created user, and Grant connection resource access to the database.

Grant connect, resource to tianuser;

6. log on to pl/SQL through the new user tianuser. After the logon is completed, create, modify, or adjust the database by calling SQL statements such as tables, methods, and stored procedures in the SQL window. See the following description.

Create table mynewtable (
SEQUENCE_ID INTEGER not null,
SUPPLIER_ID VARCHAR2 (20 ),
SUPPLIER_NAME VARCHAR2 (50 ),
AFTER_SALE_PHONE VARCHAR2 (15 ),
TELEPHONE VARCHAR2 (15 ),
CONTACT_MAN VARCHAR2 (20 ),
CONTACT_PHONE VARCHAR2 (15 ),
FAX VARCHAR2 (15 ),
EMAIL VARCHAR2 (20 ),
SUPPLIER_TYPE CHAR (1 ),
REMARK VARCHAR2 (200 ),
Constraint PK_SZ_AS_SUPPLIER primary key (SEQUENCE_ID)
);

7. In this way, tables and users, tablespaces and users are basically created. In the future, database maintenance operations can be performed through oracle exp imp and other methods.

 

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.