DB2数据库激活

db2当前激活状态

[db2inst1@xifenfei ~]$ db2licm -l
Product name:                     "DB2 Enterprise Server Edition"
License type:                     "Trial"
Expiry date:                      "06/22/2012"
Product identifier:               "db2ese"
Version information:              "9.5"

Product name:                     "DB2 Connect Server"
License type:                     "Trial"
Expiry date:                      "06/22/2012"
Product identifier:               "db2consv"
Version information:              "9.5"

查看license文件

[db2inst1@xifenfei ~]$ db2licm -l db2ese_cV9.5CPU.lic 
Product name:                     "DB2 Enterprise Server Edition"
License type:                     "CPU Option"
Expiry date:                      "Permanent"
Product identifier:               "db2ese"
Version information:              "9.5"
Features:
DB2 Database Partitioning:        "Not licensed"
DB2 Performance Optimization ESE: "Not licensed"
DB2 Storage Optimization:         "Not licensed"
DB2 Advanced Access Control:      "Not licensed"
DB2 Geodetic Data Management:     "Not licensed"
DB2 pureXML ESE:                  "Not licensed"
IBM Homogeneous Federation ESE:   "Not licensed"
IBM Homogeneous Replication ESE:  "Not licensed"

Product name:                     "DB2 Connect Server"
License type:                     "Trial"
Expiry date:                      "06/22/2012"
Product identifier:               "db2consv"
Version information:              "9.5"

导入license文件

[db2inst1@xifenfei ~]$ db2licm -a db2ese_cV9.5CPU.lic 

LIC1402I  License added successfully.


LIC1426I   This product is now licensed for use as outlined in your License Agreement.  
USE OF THE PRODUCT CONSTITUTES ACCEPTANCE OF THE TERMS OF THE IBM LICENSE AGREEMENT, 
LOCATED IN THE FOLLOWING DIRECTORY: "/opt/db2/V9.5/license/en_US.iso88591"

再次查看db2激活状态

[db2inst1@xifenfei ~]$ db2licm -l
Product name:                     "DB2 Enterprise Server Edition"
License type:                     "CPU Option"
Expiry date:                      "Permanent"
Product identifier:               "db2ese"
Version information:              "9.5"
Features:
DB2 Database Partitioning:        "Not licensed"
DB2 Performance Optimization ESE: "Not licensed"
DB2 Storage Optimization:         "Not licensed"
DB2 Advanced Access Control:      "Not licensed"
DB2 Geodetic Data Management:     "Not licensed"
DB2 pureXML ESE:                  "Not licensed"
IBM Homogeneous Federation ESE:   "Not licensed"
IBM Homogeneous Replication ESE:  "Not licensed"

Product name:                     "DB2 Connect Server"
License type:                     "Trial"
Expiry date:                      "06/22/2012"
Product identifier:               "db2consv"
Version information:              "9.5"

各种数据库的激活方式不同(只讨论激活,不涉及授权问题):
1.oracle/mysql不需要激活,可以直接使用
2.sql server 需要序列号激活
3.db2需要license文件激活

发表在 DB2 | 一条评论

linux中不能ping通hostname可能存在问题

不能ping通hostname

[oracle@xifenfei ~]$ hostname
xifenfei
[oracle@xifenfei ~]$ ping xifenfei
ping: unknown host xifenfei
[oracle@xifenfei ~]$ nslookup
> xifenfei
;; connection timed out; no servers could be reached
> exit
[oracle@xifenfei ~]$ more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1    xifenfei1 localhost.localdomain localhost

10G中存在问题

[oracle@xifenfei ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Apr 3 01:54:22 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.
--sqlplus连接非常慢

SQL> startup
ORA-00600: internal error code, arguments: [keltnfy-ldmInit], [46], [1], [], [], [], [], []
--ORA-00600[keltnfy-ldmInit]错误

11G中存在问题

[oracle@xifenfei ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 3 02:02:29 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected.
SQL> startup
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00130: invalid listener address '(ADDRESS=(PROTOCOL=TCP)(HOST=xifenfei)(PORT=1521))'

--因为不能ping通xifenfei,提示LOCAL_LISTENER错误

--修改pfile文件
local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))'

--启动数据库
SQL> startup pfile='/tmp/pfile'
ORACLE instance started.

Total System Global Area  368263168 bytes
Fixed Size                  1345016 bytes
Variable Size             306186760 bytes
Database Buffers           54525952 bytes
Redo Buffers                6205440 bytes
Database mounted.
Database opened.

[oracle@xifenfei ~]$ ps -ef|grep ora_
oracle    5960     1  0 02:09 ?        00:00:00 ora_pmon_ora11g
oracle    5964     1  0 02:09 ?        00:00:00 ora_psp0_ora11g
oracle    5970     1  1 02:09 ?        00:00:00 ora_vktm_ora11g
oracle    5976     1  0 02:09 ?        00:00:00 ora_gen0_ora11g
oracle    5980     1  0 02:09 ?        00:00:00 ora_diag_ora11g
oracle    5984     1  0 02:09 ?        00:00:00 ora_dbrm_ora11g
oracle    5988     1  0 02:09 ?        00:00:00 ora_dia0_ora11g
oracle    5992     1  0 02:09 ?        00:00:00 ora_mman_ora11g
oracle    5996     1  0 02:09 ?        00:00:00 ora_dbw0_ora11g
oracle    6000     1  0 02:09 ?        00:00:00 ora_lgwr_ora11g
oracle    6004     1  0 02:09 ?        00:00:00 ora_ckpt_ora11g
oracle    6008     1  0 02:09 ?        00:00:00 ora_smon_ora11g
oracle    6012     1  0 02:09 ?        00:00:00 ora_reco_ora11g
oracle    6016     1  0 02:09 ?        00:00:00 ora_mmon_ora11g
oracle    6020     1  0 02:09 ?        00:00:00 ora_mmnl_ora11g
oracle    6028     1  0 02:09 ?        00:00:00 ora_s000_ora11g
oracle    6055     1  0 02:10 ?        00:00:00 ora_p000_ora11g
oracle    6059     1  0 02:10 ?        00:00:00 ora_p001_ora11g
oracle    6063     1  0 02:10 ?        00:00:00 ora_arc0_ora11g
oracle    6069     1  0 02:10 ?        00:00:00 ora_arc1_ora11g
oracle    6073     1  0 02:10 ?        00:00:00 ora_arc2_ora11g
oracle    6077     1  0 02:10 ?        00:00:00 ora_arc3_ora11g
oracle    6081     1  0 02:10 ?        00:00:00 ora_qmnc_ora11g
oracle    6089     1  0 02:10 ?        00:00:00 ora_q000_ora11g
oracle    6093     1  0 02:10 ?        00:00:00 ora_q001_ora11g
oracle    6141     1  0 02:11 ?        00:00:00 ora_d000_ora11g
oracle    6145     1  2 02:11 ?        00:00:00 ora_cjq0_ora11g
--数据库启动正常

[oracle@xifenfei ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 3 02:10:37 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected.
SQL> show parameter local_listener;
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0
--sqlplus不能操作,而且sqlplus登录非常慢

监听异常

--监听配置文件
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1522))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
    )
  )
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
     (GLOBAL_DBNAME = ora11g)
     (ORACLE_HOME = /u01/oracle/oracle/product/11.2.0/db_1)
     (SID_NAME = ora11g)
    )
  )
--启动监听
[oracle@xifenfei ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 03-APR-2012 02:19:52

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Starting /u01/oracle/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /u01/oracle/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/oracle/diag/tnslsnr/xifenfei/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1522)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.10)(PORT=1522)))
--一直处于等待状态

--客户端登录
C:\Users\XIFENFEI>sqlplus sys/xifenfei@192.168.1.10:1522/ora11g

SQL*Plus: Release 11.2.0.3.0 Production on 星期二 4月 3 12:48:15 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.
--一直hang住

[root@xifenfei admin]# netstat -an|grep 1522
tcp        0      0 192.168.1.10:1522           0.0.0.0:*                   LISTEN      
tcp      260      0 192.168.1.10:1522           192.168.1.1:51977           ESTABLISHED 
tcp        0      0 192.168.1.10:24317          192.168.1.10:1522           ESTABLISHED 
tcp      198      0 192.168.1.10:1522           192.168.1.10:24317          ESTABLISHED 
--这里显示已经连接

建议:在修改主机名时要慎重,修改的时候要确保/etc/hosts和/etc/sysconfig/network文件都被正确修改

发表在 ORA-xxxxx | 标签为 | 一条评论

使用wrap加密pl/sql代码

1.测试脚本

[oracle@bas ~]$ more pkg_wrap_xff.sql 
create or replace package pkg_wrap_xff is
  procedure welcome_in(abc in varchar2);
END pkg_wrap_xff;
/
create or replace package body pkg_wrap_xff is
  procedure welcome_in(abc in varchar2) as
  begin
    dbms_output.put_line('welcome ' || abc);
  end;
END pkg_wrap_xff;
/

2.创建并测试包

SQL> @pkg_wrap_xff

Package created.


Package body created.

SQL> set serveroutput on
SQL> exec pkg_wrap_xff.welcome_in('xifenfei');
welcome xifenfei

PL/SQL procedure successfully completed.

3.查看包内容

SQL> SELECT TEXT FROM dba_source a WHERE a.name='PKG_WRAP_XFF';

TEXT
--------------------------------------------------------------
package pkg_wrap_xff is
  procedure welcome_in(abc in varchar2);
END pkg_wrap_xff;
package body pkg_wrap_xff is
  procedure welcome_in(abc in varchar2) as
  begin
    dbms_output.put_line('welcome ' || abc);
  end;
END pkg_wrap_xff;

9 rows selected.

4.使用wrap加密

[oracle@bas ~]$ wrap iname=pkg_wrap_xff.sql oname=pkg_wrap_xff.plb

PL/SQL Wrapper: Release 10.2.0.1.0- 64bit Production on Tue Apr 03 11:16:52 2012

Copyright (c) 1993, 2004, Oracle.  All rights reserved.

Processing pkg_wrap_xff.sql to pkg_wrap_xff.plb
[oracle@bas ~]$ ll pkg_wrap_xff*
-rw-r--r--  1 oracle oinstall 634 Apr  3 11:16 pkg_wrap_xff.plb
-rw-r--r--  1 oracle oinstall 273 Apr  3 10:58 pkg_wrap_xff.sql

[oracle@bas ~]$ more pkg_wrap_xff.plb 
create or replace package pkg_wrap_xff wrapped 
a000000
1
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
9
53 85
W36vGRTVGRHdbwYRR6PgEKn/uJgwg1zZf9OpynQ2Z/aHUmNhYcN/NpFphdvMis61lthVP41T
adMRoYz9KTALorx2DjxUFXms0VvEXmDignlfcQjICNxh0Rmhsp2KsCjohpTO

/
create or replace package body pkg_wrap_xff wrapped 
a000000
1
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
b
96 ce
QzGnt9RcmxQyUfes+xtqkeZypV0wg1zwqNPWfI6iCq2Ve93Dd2BzFE8hHRRYZ/LM86Rx2o0E
y67F1TM7QgP9WoGRBCUelGt4QvSOmwMecLCe57PVPD5lbxyJLK26scjDS8soGPzcCDysP+WR
C0zeZ9lSlyLXqNex8XpUxi7tILux/gNr1FIOWaBRhYqgTZ754pVDNlG4SXE=

/

4.测试加密包

SQL> drop package PKG_WRAP_XFF;

Package dropped.

SQL> @pkg_wrap_xff.plb

Package created.


Package body created.

SQL> set serveroutput on
PL/SQL procedure successfully completed.

SQL> exec pkg_wrap_xff.welcome_in('www.xifenfei.com');
welcome www.xifenfei.com

PL/SQL procedure successfully completed.

查看加密包内容

SQL> set pagesize 1000
SQL> SELECT TEXT FROM dba_source a WHERE a.name='PKG_WRAP_XFF';

TEXT
--------------------------------------------------------------------------------
package pkg_wrap_xff wrapped
a000000
1
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
9
53 85
W36vGRTVGRHdbwYRR6PgEKn/uJgwg1zZf9OpynQ2Z/aHUmNhYcN/NpFphdvMis61lthVP41T
adMRoYz9KTALorx2DjxUFXms0VvEXmDignlfcQjICNxh0Rmhsp2KsCjohpTO

package body pkg_wrap_xff wrapped
a000000
1
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
b
96 ce
QzGnt9RcmxQyUfes+xtqkeZypV0wg1zwqNPWfI6iCq2Ve93Dd2BzFE8hHRRYZ/LM86Rx2o0E
y67F1TM7QgP9WoGRBCUelGt4QvSOmwMecLCe57PVPD5lbxyJLK26scjDS8soGPzcCDysP+WR
C0zeZ9lSlyLXqNex8XpUxi7tILux/gNr1FIOWaBRhYqgTZ754pVDNlG4SXE=

原则上来说wrap加密是不可逆的过程,所以可以通过使用wrap加密,实现了屏蔽代码的作用,确保了自己的知识产权。其实oracle本身很多的系统包也是通过这种方法进行加密处理,以保护oracle的产权。

发表在 Oracle | 2 条评论