`

oracle streams学习一(创建streams管理账户和授权)

阅读更多

oracle streams需要首先创建一个管理账户,并且需要配置DBA角色等权限:

SQL> conn / as sysdba
已连接到空闲例程。

SQL> create user streamadmin identified by streamadmin;

用户已创建。

SQL> alter user streamadmin default tablespace users temporary tablespace temp quota unl
imited on users;

用户已更改。

SQL> grant connect,resource,aq_administrator_role,dba to streamadmin;

授权成功。

SQL> create directory stream_dir as 'e:\oracledir';

目录已创建。

SQL> begin dbms_streams_auth.grant_admin_privilege(grantee=>'streamadmin',grant_privileges=>false,fil
e_name=>'grant_streamadmin.sql',directory_name=>'stream_dir');
   end;
/
PL/SQL 过程已成功完成。

 

这时在 e:\oracledir目录会生成一个grant_streamadmin.sql文件,内容如下:

-- rule privileges section
grant execute on dbms_rule_adm to streamadmin
/
BEGIN 
  dbms_rule_adm.grant_system_privilege(
    privilege => dbms_rule_adm.CREATE_EVALUATION_CONTEXT_OBJ,
    grantee => 'streamadmin', 
    grant_option => true);
END;
/
BEGIN 
  dbms_rule_adm.grant_system_privilege(
    privilege => dbms_rule_adm.CREATE_RULE_SET_OBJ,
    grantee => 'streamadmin', 
    grant_option => true);
END;
/
BEGIN 
  dbms_rule_adm.grant_system_privilege(
    privilege => dbms_rule_adm.CREATE_RULE_OBJ,
    grantee => 'streamadmin', 
    grant_option => true);
END;
/
BEGIN 
  dbms_rule_adm.grant_system_privilege(
    privilege => dbms_rule_adm.CREATE_ANY_RULE_SET,
    grantee => 'streamadmin', 
    grant_option => true);
END;
/
BEGIN 
  dbms_rule_adm.grant_system_privilege(
    privilege => dbms_rule_adm.ALTER_ANY_RULE_SET,
    grantee => 'streamadmin', 
    grant_option => true);
END;
/
BEGIN 
  dbms_rule_adm.grant_system_privilege(
    privilege => dbms_rule_adm.EXECUTE_ANY_RULE_SET,
    grantee => 'streamadmin', 
    grant_option => true);
END;
/
BEGIN 
  dbms_rule_adm.grant_system_privilege(
    privilege => dbms_rule_adm.CREATE_ANY_RULE,
    grantee => 'streamadmin', 
    grant_option => true);
END;
/
BEGIN 
  dbms_rule_adm.grant_system_privilege(
    privilege => dbms_rule_adm.ALTER_ANY_RULE,
    grantee => 'streamadmin', 
    grant_option => true);
END;
/
BEGIN 
  dbms_rule_adm.grant_system_privilege(
    privilege => dbms_rule_adm.EXECUTE_ANY_RULE,
    grantee => 'streamadmin', 
    grant_option => true);
END;
/
-- queue privileges section
grant execute on dbms_aq to streamadmin
/
grant execute on dbms_aqadm to streamadmin
/
BEGIN 
  dbms_aqadm.grant_system_privilege(
    'ENQUEUE_ANY', 
    'streamadmin', 
    admin_option => TRUE); 
END;
/
BEGIN 
  dbms_aqadm.grant_system_privilege(
    'DEQUEUE_ANY', 
    'streamadmin', 
    admin_option => TRUE); 
END;
/
BEGIN 
  dbms_aqadm.grant_system_privilege(
    'MANAGE_ANY', 
    'streamadmin', 
    TRUE); 
END;
/
grant select on dba_queue_tables to streamadmin
/
grant select on dba_queues to streamadmin
/
grant select on dba_queue_schedules to streamadmin
/
grant select on sys.v_$aq to streamadmin
/
grant select on sys.gv_$aq to streamadmin
/
grant select on sys.aq$_propagation_status to streamadmin
/
grant execute on sys.dbms_aqin to streamadmin
/
grant select on sys.aq$internet_users to streamadmin
/
grant execute on sys.dbms_transform to streamadmin
/
grant execute on sys.dbms_aqelm to streamadmin
/
grant select on dba_aq_agents to streamadmin
/
grant select on dba_aq_agent_privs to streamadmin
 
 
 
/
grant select on dba_queue_subscribers to streamadmin
/
-- streams packages section
grant execute on dbms_capture_adm to streamadmin
/
grant execute on dbms_propagation_adm to streamadmin
/
grant execute on dbms_apply_adm to streamadmin
/
grant execute on dbms_streams_adm to streamadmin
/
grant execute on dbms_streams_messaging to streamadmin
 
/
-- streams views section
grant select on dba_streams_global_rules to streamadmin
/
grant select on dba_streams_schema_rules to streamadmin
/
grant select on dba_streams_table_rules to streamadmin
/
grant select on dba_streams_transform_function to streamadmin
/
grant select on dba_streams_administrator to streamadmin
/
grant select on dba_streams_message_rules to streamadmin
/
grant select on dba_streams_message_consumers to streamadmin
/
grant select on dba_apply to streamadmin
/
grant select on dba_apply_parameters to streamadmin
/
grant select on dba_apply_instantiated_objects to streamadmin
/
grant select on dba_apply_instantiated_schemas to streamadmin
/
grant select on dba_apply_instantiated_global to streamadmin
/
grant select on dba_apply_key_columns to streamadmin
/
grant select on dba_apply_conflict_columns to streamadmin
/
grant select on dba_apply_dml_handlers to streamadmin
/
grant select on dba_apply_progress to streamadmin
/
grant select on dba_apply_error to streamadmin
/
grant select on dba_apply_enqueue to streamadmin
/
grant select on dba_apply_execute to streamadmin
/
grant select on sys.gv_$streams_apply_coordinator to streamadmin
/
grant select on sys.v_$streams_apply_coordinator to streamadmin
/
grant select on sys.gv_$streams_apply_server to streamadmin
/
grant select on sys.v_$streams_apply_server to streamadmin
/
grant select on sys.gv_$streams_apply_reader to streamadmin
/
grant select on sys.v_$streams_apply_reader to streamadmin
/
grant select on dba_capture to streamadmin
/
grant select on dba_capture_parameters to streamadmin
/
grant select on dba_capture_prepared_database to streamadmin
/
grant select on dba_capture_prepared_schemas to streamadmin
/
grant select on dba_capture_prepared_tables to streamadmin
/
grant select on dba_capture_extra_attributes to streamadmin
/
grant select on dba_registered_archived_log to streamadmin
/
grant select on sys.gv_$streams_capture to streamadmin
/
grant select on sys.v_$streams_capture to streamadmin
/
grant select on dba_rule_sets to streamadmin
/
grant select on dba_rulesets to streamadmin
/
grant select on dba_rules to streamadmin
/
grant select on  dba_rule_set_rules to streamadmin
/
grant select on dba_evaluation_contexts to streamadmin
/
grant select on dba_evaluation_context_tables to streamadmin
/
grant select on dba_evaluation_context_vars to streamadmin
/
grant select on dba_queue_publishers to streamadmin
/
grant select on sys.gv_$buffered_queues to streamadmin
/
grant select on sys.v_$buffered_queues to streamadmin
/
grant select on sys.gv_$buffered_subscribers to streamadmin
/
grant select on sys.v_$buffered_subscribers to streamadmin
/
grant select on sys.gv_$buffered_publishers to streamadmin
/
grant select on sys.v_$buffered_publishers to streamadmin
/
grant select on dba_propagation to streamadmin
 
/
-- streams views section
grant select on dba_streams_unsupported to streamadmin
/
-- streams views section
grant select on dba_streams_newly_supported to streamadmin
/
grant select on dba_streams_rules to streamadmin
/
grant select on dba_apply_table_columns to streamadmin
/
grant select on dba_streams_add_column to streamadmin
/
grant select on dba_streams_delete_column to streamadmin
/
grant select on dba_streams_rename_column to streamadmin
/
grant select on dba_streams_rename_schema to streamadmin
/
grant select on dba_streams_rename_table to streamadmin
/
grant select on dba_streams_transformations to streamadmin
/
grant select on dba_apply_spill_txn to streamadmin
/
grant select on sys.gv_$streams_transaction to streamadmin
/
grant select on sys.v_$streams_transaction to streamadmin
/
-- miscellaneous privileges section
grant restricted session to streamadmin
/
grant execute on dbms_flashback to streamadmin
/
BEGIN 
  dbms_streams_auth.grant_remote_admin_access('streamadmin'); 
END;
/

 然后执行这个脚本,就会给streamadmin用户相应权限了

 

SQL> @"E:\oracledir\grant_streamadmin.sql"
......
授权成功。

 

    或者另一种简单的方式:直接调用DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE过程

SQL> desc dbms_streams_auth;
PROCEDURE GRANT_ADMIN_PRIVILEGE
参数名称                       类型                    输入/输出默认值?
------------------------------ ----------------------- ------ --------
 GRANTEE                        VARCHAR2                IN
 GRANT_PRIVILEGES               BOOLEAN                 IN     DEFAULT
 FILE_NAME                      VARCHAR2                IN     DEFAULT
 DIRECTORY_NAME                 VARCHAR2                IN     DEFAULT
PROCEDURE GRANT_REMOTE_ADMIN_ACCESS
参数名称                       类型                    输入/输出默认值?
------------------------------ ----------------------- ------ --------
 GRANTEE                        VARCHAR2                IN
PROCEDURE REVOKE_ADMIN_PRIVILEGE
参数名称                       类型                    输入/输出默认值?
------------------------------ ----------------------- ------ --------
 GRANTEE                        VARCHAR2                IN
 REVOKE_PRIVILEGES              BOOLEAN                 IN     DEFAULT
 FILE_NAME                      VARCHAR2                IN     DEFAULT
 DIRECTORY_NAME                 VARCHAR2                IN     DEFAULT
PROCEDURE REVOKE_REMOTE_ADMIN_ACCESS
参数名称                       类型                    输入/输出默认值?
------------------------------ ----------------------- ------ --------
 GRANTEE                        VARCHAR2                IN

SQL> begin
  2  dbms_streams_auth.grant_admin_privilege(grantee=>'streamadmin',grant_privileges=>true);
  3  end;
  4  /

PL/SQL 过程已成功完成。

SQL> 

  这样就会给streamadmin相应权限了。

  撤销权限的方式也很简单,只要调用 DBMS_STREAMS_AUTH.REVOKE_ADMIN_PRIVILEGE过程就可以了

SQL> begin
  2  dbms_streams_auth.revoke_admin_privilege(grantee=>'streamadmin',revoke_privileges=>true);
  3  end;
  4  /

PL/SQL 过程已成功完成。

SQL> 

 

 

 

 

分享到:
评论

相关推荐

    oracle DBA的学习方法

    Oracle DBA的学习方法是一个系统性的过程,涉及到许多关键知识点。...总之,Oracle DBA的学习是一条漫长且充满挑战的道路,需要持续学习、实践和深入研究,才能成为一名合格的Oracle数据库管理员。

    Oralce 10g install linux4

    Oracle Streams 是 Oracle Database 10g 的一个核心特征,它提供了一个统一的环境,用于数据共享、消息队列和数据复制。通过 Oracle Streams,用户可以实现实时的数据同步,这对于多站点操作和高可用性系统至关重要...

    Oracle 10g 开发与管理

    DBCA(Database Configuration Assistant)是Oracle提供的数据库配置助手,用于简化数据库的创建和配置过程。可以通过命令行或图形界面启动DBCA来创建新的数据库或配置现有的数据库。 - **服务设置** 在安装完成...

    Oracle DBA资料总结

    - **用户**:包括创建、删除用户账户,设置用户的权限和角色,以及进行用户的认证和授权管理等操作。 #### 网络配置 - **网络**:涉及到监听器(Listener)的配置,网络服务名(service name)的设置,以及网络连接...

    oracle原厂培训笔记

    - **Schema**: 表示用户账户下所有对象的集合,是Oracle数据库的重要概念之一。 - **Block Size**: 数据块大小由`DB_BLOCK_SIZE`初始化参数决定,需为操作系统块大小的倍数。 以上内容涵盖了Oracle原厂培训笔记中的...

    oracle技术参考资料(一)

    Oracle技术参考资料(一)主要涵盖了Oracle数据库系统的基础知识和关键技术,是学习和理解Oracle数据库系统的重要资源。Oracle数据库是全球广泛使用的大型关系型数据库管理系统之一,它提供了高效的数据存储、管理和...

    如何成为oracle dba (转)

    - **创建与管理用户**:学会创建和管理Oracle用户。 #### 九、掌握数据字典与性能视图 1. **数据字典**:学习如何查询Oracle的数据字典。 - **动态性能视图**:熟悉V$系列视图,用于监控系统状态。 #### 十、...

    Oracle10G数据库管理习题集.doc

    Oracle 10G数据库管理系统是一个强大的关系型数据库平台,广泛应用于企业级数据存储和管理。以下是一些基于题目内容的相关知识点: 1. **统计信息收集**:Oracle数据库允许管理员定期更新统计信息以优化查询性能。...

    Oracleblogstudy相关资料.docx

    - **用户管理**:创建、修改用户账户及其权限。 - **角色管理**:定义角色及其关联的权限集。 - **审计与监控** - **审计跟踪**:记录数据库活动,帮助检测安全威胁。 - **性能监控**:分析数据库性能瓶颈,优化...

    64位linux版jdk8.zip

    JDK是开发和运行Java应用程序的基础,它包括Java编译器、Java虚拟机(JVM)、类库以及各种工具,使得程序员能够创建、调试和管理Java应用程序。 【描述】提及了从Oracle官方下载JDK8的不便之处,主要体现在两个方面...

    openfire_3_8_1.zip

    - **用户管理**:创建、修改和删除用户账户,支持LDAP、Active Directory等外部身份验证源。 - **群聊与多用户聊天室**:允许多人参与的实时交流,可以设置权限和访问控制。 - **安全通信**:支持SSL/TLS加密,确保...

    jdk-7u51-windows-x64

    5. **并发改进**:包括`ForkJoinPool`和`Parallel Streams`,提供了并行计算的能力。 6. **文件系统API增强**:引入了`java.nio.file`包,提供了更强大的文件系统操作功能。 7. **类型注解**:允许在更多地方使用...

    2021年大数据常见面试题.docx

    面试中,招聘者通常会通过一系列问题来考察候选人的技能和经验。以下是一些常见的大数据面试题及其相关知识点: 1. 大数据处理能力:面试官可能会询问你处理的最大数据量,以了解你的大数据处理经验。此外,还会问...

Global site tag (gtag.js) - Google Analytics