Oracle issues a small note five: Service start - index - sub-query - paging stored procedure

Today, the Autumn Park QBlog  data to guide Oracle to run, to regain Oracle, under the main problems in the process of the record:

 

1: Service Startup Problems

This problem occurs many times, it makes the hair right network name change computing, Oracle opened a long time did not did not care, Oracle service startup total failure, after agonizing discovery, then go back and change the name of the computer, restart the computer, and then enable service, normal.

 

2: indexing problems

Guide to Oracle data, we found that some simple change quite slow query such as:

select id,username,title from blog_content where userid=111 order by id desc

But then, through point of pulling the page, plus an index to the title on the fast: "select the place that contains the index (oracle said in a covering index)"
then other queries slow, all indexed to speed it up, it seems to engage in Oracle not to engage in the index, there is no way to play.

 

3: sub-query problem

Normal Code:

SELECT count(*) as UserCount,
(SELECT count(*)  FROM Blog_Content WHERE TypeID=0) as ArticleCount
FROM Blog_User

This statement were normal in Access, Mssql, Sqlite, Mysql, Oracle is not alone, add a function to solve the following:

SELECT count(*) as UserCount,
min((SELECT count(*)  FROM Blog_Content WHERE TypeID=0)) as ArticleCount

FROM Blog_User

 

4: stored procedure call problem

problem:

Varchar2 parameters stored procedure, if the code parameter is empty, it will report an exception: ORA-01084: invalid argument in OCI call view

If executed in PL / SQL, and wrong.

The solution is empty, the transfer DBNull.Value.

 

5: perfect CYQ.Data for the Oracle version of the page stored procedure.

Directly modify the article: toss Oracle dishes question in mind [paging stored procedure / query all the tables, views, stored procedures / query tables, views, stored procedures, field structure and parameters] (c)

 

6: Modify Field Order

Adding columns, I do not want to put the final surface, pull up, and had to write code to change the sequence number.

 

select object_id from all_objects where object_name = ' BLOG_COMMENT' - lookup ID
SELECT COL #, name from SYS.COL WHERE obj $ # = sequence number field look 49244--

update sys.col $ set COL # = 8 where obj # = 49244 and name = 'CREATETIME' - Update the number of

 

7: Update sequence initial value

A common database for the increment sequence ID, serial data End guide value has not changed, the value needs to be adjusted.

ALTER SEQUENCE sequence name Increment new digital By;

 

Reproduced in: https: //my.oschina.net/secyaher/blog/274274

Guess you like

Origin blog.csdn.net/weixin_33754065/article/details/91966893