Notes on Oracle Problems

Source: Internet
Author: User

Here is a simple record.:

Record 1: N was installed with Oracle 10 a long time ago. I logged on again two days ago and found that the login failed. I always reported an error such as the host does not exist. As a result, the database was reinstalled, deleted, deleted, and created, this loop.


It was found that the computing name was modified not long ago. There were several files in the C: \ oracle \ product \ 10.1.0 \ Db_1 \ NETWORK \ ADMIN directory,

Open the record with host = xxx, and change xxx to a new computer name.



Record 2: When you log on with the Sys user and create a table such as Users, the user of the table belongs to Sys, you cannot create a trigger for the Users table.


Create another account to create a table



Record 3: When logging on with sa [New Account], do not select SysDBA for the Connect as option. The default value is Normal. Otherwise, the problem is that the created table cannot be seen, and the access ratio must be: user name. table Name


Record 4: Oracle time is of the date type. The default function of the system time is sysdate.


Record 5: The oracle table does not have an auto-increment ID. sequence is required. The sequence creation code is:

-- Create sequence
Create sequence AutoID
Minvalue 1
Max value 9999999
Start with 1
Increment by 1


You can directly create sequences using PL/SQL tools.

The current value of the sequence is AutoID. Currval.

The first value of the sequence is AutoID. Nextval.



Record 6: Create an auto-increment ID. The trigger code is as follows:

Create or replace trigger name

Before insert on table name

For each row


Select sequence name. nextval into: new. ID from dual;



Note: Although triggers can be used, a trigger can only be used for a single table. Do you need to create a trigger for each table?


RECORD 7: No trigger is needed for the auto-increment ID. Use the code to call [Sequence name. Nextval]. For example, the SQL statement is:

Insert into Message (id, UserID, Body, Url) values (AutoID. nextval, 3, 'Passing by autumn ', 'HTTP: // ')



Record 8: The statement for granting permissions to a user is:

Grant dba, resource, connect to user name;


Of course, it is simpler and more intuitive to use visual selection settings.


Related Article

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: 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.