添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more >

Database Link is used to insert data into tables in a remote database. If the sequence in the local database is used

Will encounter ORA-02069: The global_names parameter for this operation must be set to true.

Solution: Use the sequence in the remote database.

1. The Scott User grants the report user the select, insert, and update permissions on the dept table.

SQL> conn Scott/Tiger
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as Scott
SQL> grant select, insert, update on dept to report;
Grant succeeded

2. The report user establishes the Scott user's database link (the database link is only used to simulate the problem)

SQL> conn report/Report
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as report

SQL> CREATE DATABASE LINK Scott
2 connect to Scott identified by Tiger
3 using 'liangwei ';
Database link created

3. Create based on database link Dept @ Scott Synonym of a table

SQL> Create or replace synonym dept for dept @ Scott;
Synonym created

4. Create a sequence deptid under the report user

SQL> Create sequence deptid
2 minvalue 10
3 maxvalue 1000
4 start with 30
5 increment by 1
6 cache 20;

Sequence created

5. Insert data into the new synonym dept with the sequence deptid, And the ORA-02069 appears

SQL> insert into dept values (deptid. nextval, 'code', 'bj ');

Insert into dept values (deptid. nextval, 'code', 'bj ')

ORA-02069: The global_names parameter for this operation must be set to true

SQL> show parameter global_names

Name type value
-----------------------------
Global_names Boolean false

If global_names is not set to true, can this problem be solved.

6. log on to Scott to create a sequence deptid.
SQL> conn Scott/Tiger
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as Scott

SQL> Create sequence deptid
2 minvalue 10
3 maxvalue 1000
4 start with 30
5 increment by 1
6 cache 20;

Sequence created

7. Delete the deptid sequence from the report user.

SQL> conn report/Report
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as report

SQL> drop sequence deptid;
Sequence dropped

8. Use the sequence to insert data under the repot user as the synonym Dept

SQL> insert into dept values (deptid. nextval, 'code', 'bj ');
Insert into dept values (deptid. nextval, 'code', 'bj ')
ORA-02289: sequence does not exist

Because the sequence deptid under the report user can be deleted, so the error ORA-02289: sequence does not exist

9. Use the sequence of scoot users through database link to insert data to the synonym dept in the report user. OK

SQL> insert into dept values (deptid. nextval @ Scott, 'code', 'bj ');
1 row inserted

SQL> commit;
Commit complete

SQL> select * from Dept;
Deptno dname Loc
---------------------------------
31 Code BJ
10 Accounting New York
20 research Dallas
30 sales chicago1
40 operations Boston
11 code Beijing
6 rows selected

Conclusion: The sequence in the remote database should be used when data is inserted into the remote database through database link.

This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or complaint, to [email protected]. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.

Related Keywords: number sequence database php link to database select from database link sql server database link link database to website create database link command drop database link

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: [email protected] and provide relevant evidence. A staff member will contact you within 5 working days. Mac Ping:sendto:Host is down Ping does not pass other people's IP, can ping through the router Webmaster resources (site creation required) (SOLR is successfully installed on the office machine according to this method) Methods for generating various waveform files Vcd,vpd,shm,fsdb Solution to the problem that WordPress cannot be opened after "WordPress address (URL)" is modified in the background OpenGL Series Tutorial Eight: OpenGL vertex buffer Object (VBO) Perfect: Adobe premiere cs6 cracked version download [serial number + Chinese pack + hack patch + hack tutorial] How about buyvm.net space? Buyvm.net's VPS Evaluation Frequently-used website keyword The difference between append, prepend, before and after methods in jquery __jquery microsoft download center down wordpress address url site address url wordpress address url windows installer 4 0 download 302 not found web address url definition site address url wordpress db2 integer mac os installation step by step pdf abbreviation for return

A Free Trial That Lets You Build Big!

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

Get Started for Free //intl.aliyun.com/pricing //intl.aliyun.com/trust-center //intl.aliyun.com/free-trial/enterprise //intl.aliyun.com/startup //intl.aliyun.com/partner