温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Dataguard 11.4 ORA-12154: TNS:could not resolve the connect identifier 处理

发布时间:2020-07-07 02:59:23 来源:网络 阅读:1186 作者:wangluochongzi 栏目:大数据

ORA-12154: TNS:could not resolve the connect identifier specified 处理

SQL> select dest_name,status,error from v$archive_dest  where rownum <3;


DEST_NAME                  STATUS    ERROR

--------------------------------------- -------------------------------

LOG_ARCHIVE_DEST_1         VALID

LOG_ARCHIVE_DEST_2         ERROR     ORA-12154: TNS:could not resolve the connect identifier specified

其中:

Tnsping tnsname 是通的,但是这里依旧报错排错原因:

Primary端:

log_archive_dest_2                   string      service=orcl_dg async

                                                   valid_for=(online_logfiles,p

                                                 rimary_role)

                                                   db_unique_name=orcl_dg

standby 端:

SQL> show parameter fal


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

fal_client                           string      orcl_primary

fal_server                           string      orcl_standby

SQL> show parameter service_name          


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

service_names                        string      orcl_dg

SQL>

检查两端Tnsnames.ora 配置:

orcl_primary =

(DESCRIPTION = 

        (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.1.244)(PORT = 1521)) 

    (CONNECT_DATA = 

             (SERVER = DEDICATED) 

                 (SERVICE_NAME = orcl_pm)

    )

)

orcl_standby =

(DESCRIPTION = 

        (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.1.245)(PORT = 1521)) 

    (CONNECT_DATA = 

             (SERVER = DEDICATED) 

                 (SERVICE_NAME = orcl_dg) 

    )

)

注:参数LOG_ARCHIVE_DEST_n Parameter Attributes里面的service是指:net_service_name

When you specify a SERVICE attribute:

You identify remote destinations by specifying the SERVICE attribute with a valid Oracle Net service name (SERVICE=net_service_name) that identifies the remote Oracle database instance to which the redo data will be sent.

The Oracle Net service name that you specify with the SERVICE attribute is translated into a connection descriptor that contains the information necessary for connecting to the remote database.

因此:log_archive_log_2中的service是指tnsnames.ora中的net_service_name,并不是standby库中的service_name

在主库中修改log_archive_log_2参数:

alter system set  log_archive_dest_2='service=orcl_standby async

  valid_for=(online_logfiles,primary_role)

  db_unique_name=orcl_dg'  scope=spfile;

修改备库:

alter system set log_archive_dest_2='service=orcl_primary async

 valid_for=(online_logfiles,primary_role) 

db_unique_name=orcl_pm' scope=spfile;

重启库和监听OK!

以前配置时,service_name,unique_name,tnsname 都是一样,没有清楚的理解这里log_archive_dest_2中的service的概念。


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI