新创建的数据库,执行db2look时,遇到package db2lkfun.bnd bind failed

在新创建的数据库中,执行db2look的时候,存在这样的问题

[email protected] ~]$ db2look -d sample -e -l -o db2look.ddl
-- No userid was specified, db2look tries to use Environment variable USER
-- USER is: DB2V97I1
-- Creating DDL for table(s)
-- Output is sent to file: db2look.ddl
-- Binding package automatically ...
--An error has occured during Binding

Error Message =
SQL0001N  Binding or precompilation did not complete successfully.

SQLCA  
Size    = 136
SQLCODE = -1
Tokens  = /home/db2v97i1/sqllib/bnd/db2lkfun.bnd
RDS fn  = sqlajbnd
RC      = 0x0000 = 0
Reason  = 0x0000 = 0
Reason2 = 0x0000 = 0
Warning flags =        

--An error has occured during Binding

Error Message =
SQL0031C  File "/home/db2v97i1/db2lkfun.bnd" could not be opened.

SQLCA  
Size    = 136
SQLCODE = -31
Tokens  = /home/db2v97i1/db2lkfun.bnd
RDS fn  = sqlajbnd
RC      = 0x0000 = 0
Reason  = 0x0000 = 0
Reason2 = 0x0000 = 0
Warning flags =       

Try to run the command db2 "bind  db2lkfun.bnd   blocking all grant public", got the error about authorization.

[email protected] bnd]$  db2 "bind  db2lkfun.bnd   blocking all grant public"

LINE    MESSAGES FOR db2lkfun.bnd
------  --------------------------------------------------------------------
        SQL0061W  The binder is in progress.
12291   SQL0440N  No authorized routine named "RTRIM" of type
                  "FUNCTION" having compatible arguments was found. 
                  SQLSTATE=42884
12987   SQL0440N  No authorized routine named "RTRIM" of type
                  "FUNCTION" having compatible arguments was found. 
                  SQLSTATE=42884
        SQL0082C  An error has occurred which has terminated
                  processing.
        SQL0092N  No package was created because of previous errors.
        SQL0091N  Binding was ended with "4" errors and "0" warnings.

Check the authorizations for the user

[[email protected] ~]$ db2 " SELECT SUBSTR(GRANTOR, 1, 10) AS GRANTOR, -- Grantor of the authority
> SUBSTR(GRANTEE, 1, 10) AS GRANTEE, -- Holder of the authority
> -- G = Grantee is a group R = Grantee is a role
> GRANTEETYPE, -- U = Grantee is an individual user
> BINDADDAUTH,
> CONNECTAUTH,
> CREATETABAUTH,
> DBADMAUTH,
> IMPLSCHEMAAUTH,
> DATAACCESSAUTH,
> LOADAUTH
> FROM SYSCAT.DBAUTH
> ORDER BY GRANTEE WITH UR "

GRANTOR    GRANTEE    GRANTEETYPE BINDADDAUTH CONNECTAUTH CREATETABAUTH DBADMAUTH IMPLSCHEMAAUTH DATAACCESSAUTH LOADAUTH
---------- ---------- ----------- ----------- ----------- ------------- --------- -------------- -------------- --------
SYSIBM     DB2V97I1   U           N           N           N             Y         N              Y              N      
SYSIBM     PUBLIC     G           Y           Y           Y             N         Y              N              N      

 

[[email protected] ~]$ cd sqllib/bnd
[[email protected] bnd]$ db2 BIND db2lkfun.bnd BLOCKING ALL GRANT PUBLIC

LINE    MESSAGES FOR db2lkfun.bnd
------  --------------------------------------------------------------------
        SQL0061W  The binder is in progress.
12291   SQL0440N  No authorized routine named "RTRIM" of type
                  "FUNCTION" having compatible arguments was found. 
                  SQLSTATE=42884
12987   SQL0440N  No authorized routine named "RTRIM" of type
                  "FUNCTION" having compatible arguments was found. 
                  SQLSTATE=42884
        SQL0082C  An error has occurred which has terminated
                  processing.
        SQL0092N  No package was created because of previous errors.
        SQL0091N  Binding was ended with "4" errors and "0" warnings.

 

Grant SECADM to the user, solve the issue.

db2 grant SECADM on database to user db2v97i1

 

 

Security administration authority (SECADM)

SECADM authority is the security administration authority for a specific database. This authority allows you to create and manage security-related database objects and to grant and revoke all database authorities and privileges. Additionally, the security administrator can execute, and manage who else can execute, the audit system routines.

SECADM authority has the ability to SELECT from the catalog tables and catalog views, but cannot access data stored in user tables.

SECADM authority can be granted only by the security administrator (who holds SECADM authority) and can be granted to a user, a group, or a role. PUBLIC cannot obtain the SECADM authority directly or indirectly.

The database must have at least one authorization ID of type USER with the SECADM authority. The SECADM authority cannot be revoked from every authorization ID of type USER
SECADM authority gives a user the ability to perform the following operations:

    Create, alter, comment on, and drop:
        Audit policies
        Security label components
        Security policies
        Trusted contexts
    Create, comment on, and drop:
        Roles
        Security labels
    Grant and revoke database privileges and authorities
    Execute the following audit routines to perform the specified tasks:
        The SYSPROC.AUDIT_ARCHIVE stored procedure and table function archive audit logs.
        The SYSPROC.AUDIT_LIST_LOGS table function allows you to locate logs of interest.
        The SYSPROC.AUDIT_DELIM_EXTRACT stored procedure extracts data into delimited files for analysis.

    Also, the security administrator can grant and revoke EXECUTE privilege on these routines, therefore enabling the security administrator to delegate these tasks, if desired. Only the security administrator can grant EXECUTE privilege on these routines. EXECUTE privilege WITH GRANT OPTION cannot be granted for these routines (SQLSTATE 42501).
    Use of the AUDIT statement to associate an audit policy with a particular database or database object at the server
    Use of the TRANSFER OWNERSHIP statement to transfer objects not owned by the authorization ID of the statement

No other authority gives these abilities.

Only the security administrator has the ability to grant other users, groups, or roles the ACCESSCTRL, DATAACCESS, DBADM, and SECADM authorities.

In Version 9.7, the DB2? authorization model has been updated to clearly separate the duties of the system administrator, the database administrator, and the security administrator. As part of this enhancement, the abilities given by the SECADM authority have been extended. In releases prior to Version 9.7, SECADM authority did not provide the ability to grant and revoke all privileges and authorities. Also, SECADM authority could be granted only to a user, not to a role or a group. Additionally, SECADM authority did not provide the ability to grant EXECUTE privilege to other users on the audit system-defined procedures and table function.

时间: 2024-11-01 14:04:28

新创建的数据库,执行db2look时,遇到package db2lkfun.bnd bind failed的相关文章

数据库执行语句时,严重注意类型转换的问题

这次上线遇到一个bug,导致回滚.定位到问题,发现是sql执行时一个语句坑了. 简单说下,就以update语句为例. 创建一个表: CREATE TABLE `test_01` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'auto incr id', `a_id` varchar(50) NOT NULL DEFAULT ' ' COMMENT 'aid', `a_name` varchar(50) NOT NULL DEFAULT '

createdb - 创建一个新的 PostgreSQL 数据库

SYNOPSIS createdb [ option...] [ dbname] [ description] DESCRIPTION 描述 createdb 创建一个新的 PostgreSQL 数据库. 通常,执行这个命令的数据库用户成为新数据库的所有者. 不过,如果执行用户拥有合适的权限,那么他可以通过 -O 指定合适的用户. createdb 是一个 SQL 命令 CREATE DATABASE [create_database(7)] 的封装. 因此,用哪种方法创建数据库都没什么特别的.

Android中当数据库需要更新时我们该怎么办?

问题:Android数据库更新并保留原来的数据如何实现 Andoird的SQLiteOpenHelper类中有一个onUpgrade方法.帮助文档中只是说当数据库升级时该方法被触发.经过实践,解决了我一连串的 疑问:1. 帮助文档里说的"数据库升级"是指什么?你开发了一个应用,当前是1.0版本.该程序用到了数据库.到1.1版本时,你在数据库的某个表中增加了一个字段.那么软件1.0版本用的数据库在软件1.1版本就要被升级了(当然这里的升级包括两个概念,一个是应用升级还有就是数据库升级)

如何创建PostgreSQL数据库

PostgreSQL提供两种方式创建一个新的数据库:第一种是使用CREATE DATABASE的SQL命令.第二种使用createdb的一个命令行可执行文件. 第一种:使用CREATE DATABASE来创建数据库. 语法格式: CREATE DATABASE语句的基本语法如下:  CREATE DATABASE dbname;    其中dbname是要创建的数据库的名称. 举例说明: 下面是一个简单的例子,这将创建testdb 在PostgreSQL模式: 说明:我们输入create dat

创建ASP.NET Core MVC应用程序(3)-基于Entity Framework Core(Code First)创建MySQL数据库表

创建ASP.NET Core MVC应用程序(3)-基于Entity Framework Core(Code First)创建MySQL数据库表 创建数据模型类(POCO类) 在Models文件夹下添加一个User类: namespace MyFirstApp.Models { public class User { public int ID { get; set; } public string Name { get; set; } public string Email { get; se

Ubuntu18.04系统执行语句时出现错误Failed to load module "canberra-gtk-module"

Ubuntu18.04系统执行gnuradio-companion时,命令行提示错误Failed to load module "canberra-gtk-module",虽然看起来不影响使用,但是总觉得别扭. 解决办法:命令行输入: sudo apt install libcanberra-gtk-module 原文地址:https://www.cnblogs.com/jsdy/p/11428925.html

Oracle>>通过PL/SQL程序块判断,指定用户的指定数据表和序列是否存在,如果存在则删除,否则新创建。并且为表添加含有字符串数据,execute immediate执行insert语句中有字符串解决办法

--变量声明 declare num0 number; num1 number; begin --判断用户为:SYSTEM的数据库中是否存在相关数据表和序列,存在则删除,不存在则新创建,DBMS_OUTPUT.put_line等同java中的System.out.println输出语句 DBMS_OUTPUT.put_line('正在初始化数据库信息,请稍后......'); --以下参数说明: --所涉及到的参数值必须为大写 --sequence_owner:指定哪个数据库用户的序列: seq

以编程的方式使用SQLite数据库 执行CRUD(创建 读取 更新 删除)操作

DBAdapter数据库辅助类 package com.databses; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.s

Android入门(十)SQLite创建升级数据库

原文链接:http://www.orlion.ga/603/ 一.创建数据库 Android为了让我们能够更加方便地管理数据库,专门提供了一个 SQLiteOpenHelper帮助类, 借助这个类就可以非常简单地对数据库进行创建和升级. SQLiteOpenHelper是一个抽象类,其中有两个抽象方法分别是onCreate()和onUpgrade(),分别在这两个方法中实现创建和升级数据库的逻辑 SQLiteOpenHelper还有两个十分重要的实例方法,getReadableDatabase(