作者归档:louis

oracle easy connect ORA-12504

[oracle@edbjr4p5 admin]$ sqlplus sys@127.0.0.1:1521/pdb2_1

SQL*Plus: Release 12.1.0.2.0 Production on Tue Jun 14 12:04:39 2016

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

ERROR:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

Enter user-name: ^C

[oracle@edbjr4p5 admin]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 – Production on 14-JUN-2016 12:04:01

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=edbjr4p5.us.oracle.com)(PORT=1521)))
STATUS of the LISTENER
————————
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 – Production
Start Date                08-JUN-2016 18:35:16
Uptime                    5 days 17 hr. 28 min. 44 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/edbjr4p5/listener/alert/log.xml
Listening Endpoints Summary…
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edbjr4p5.us.oracle.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=edbjr4p5.us.oracle.com)(PORT=5502))(Presentation=HTTP)(Session=RAW))
Services Summary…
Service “cdb1” has 1 instance(s).
  Instance “cdb1”, status READY, has 1 handler(s) for this service…
Service “cdb1XDB” has 1 instance(s).
  Instance “cdb1”, status READY, has 1 handler(s) for this service…
Service “cdb2” has 1 instance(s).
  Instance “cdb2”, status READY, has 1 handler(s) for this service…
Service “cdb2XDB” has 1 instance(s).
  Instance “cdb2”, status READY, has 1 handler(s) for this service…
Service “em12rep” has 1 instance(s).
  Instance “em12rep”, status READY, has 1 handler(s) for this service…
Service “em12repXDB” has 1 instance(s).
  Instance “em12rep”, status READY, has 1 handler(s) for this service…
Service “pdb1_1” has 1 instance(s).
  Instance “cdb1”, status READY, has 1 handler(s) for this service…
Service “pdb2_1” has 1 instance(s).
  Instance “cdb2”, status READY, has 1 handler(s) for this service…
The command completed successfully

[oracle@edbjr4p5 admin]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue Jun 14 12:04:09 2016

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> connect sys\@localhost:1521\/pdb2_1 as sysdba
Enter password:
Connected.
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

[oracle@edbjr4p5 admin]$ sqlplus sys@\”127.0.0.1:1521/pdb2_1\”

SQL*Plus: Release 12.1.0.2.0 Production on Tue Jun 14 12:04:51 2016

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

Enter password:
ERROR:
ORA-28009: connection as SYS should be as SYSDBA or SYSOPER

Enter user-name: ^C
[oracle@edbjr4p5 admin]$ sqlplus sys@\”127.0.0.1:1521/pdb2_1\” as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue Jun 14 12:05:03 2016

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

Enter password:

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> show user
USER is “SYS”
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

阿里云 php php-fpm mysql nginx apc

vi /etc/yum.repos.d/nginx.repo

[root@w1 ~]# vi /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

[root@w1 ~]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.esocc.com
 * extras: mirror.esocc.com
 * updates: mirror.esocc.com
nginx                                                    | 2.9 kB     00:00
nginx/primary_db                                         |  28 kB     00:00
Setting up Update Process
No Packages marked for Update
[root@w1 ~]# yum list|grep nginx
nginx.x86_64                              1.4.7-1.el6.ngx               nginx
nginx-debug.x86_64                        1.4.7-1.el6.ngx               nginx
[root@w1 ~]#
[root@w1 ~]# yum install nginx
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.esocc.com
 * extras: mirror.esocc.com
 * updates: mirror.esocc.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 0:1.4.7-1.el6.ngx will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch            Version                    Repository      Size
================================================================================
Installing:
 nginx          x86_64          1.4.7-1.el6.ngx            nginx          312 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 312 k
Installed size: 771 k
Is this ok [y/N]: y
Downloading Packages:
nginx-1.4.7-1.el6.ngx.x86_64.rpm                         | 312 kB     00:10
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : nginx-1.4.7-1.el6.ngx.x86_64                                 1/1
----------------------------------------------------------------------

Thanks for using nginx!

Please find the official documentation for nginx here:
* http://nginx.org/en/docs/

Commercial subscriptions for nginx are available on:
* http://nginx.com/products/

----------------------------------------------------------------------
  Verifying  : nginx-1.4.7-1.el6.ngx.x86_64                                 1/1

Installed:
  nginx.x86_64 0:1.4.7-1.el6.ngx

Complete!
[root@w1 ~]#
[root@w1 ~]# service nginx status
nginx is stopped
[root@w1 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@w1 ~]# service nginx start
Starting nginx:                                            [  OK  ]
[root@w1 ~]#
[root@w1 nginx]# yum install php-fpm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.esocc.com
 * extras: mirror.esocc.com
 * updates: mirror.esocc.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-fpm.x86_64 0:5.3.3-27.el6_5 will be installed
--> Processing Dependency: php-common(x86-64) = 5.3.3-27.el6_5 for package: php-fpm-5.3.3-27.el6_5.x86_64
--> Running transaction check
---> Package php-common.x86_64 0:5.3.3-27.el6_5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package            Arch           Version                Repository       Size
================================================================================
Installing:
 php-fpm            x86_64         5.3.3-27.el6_5         updates         1.1 M
Installing for dependencies:
 php-common         x86_64         5.3.3-27.el6_5         updates         525 k

Transaction Summary
================================================================================
Install       2 Package(s)

Total download size: 1.7 M
Installed size: 6.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): php-common-5.3.3-27.el6_5.x86_64.rpm              | 525 kB     00:00
(2/2): php-fpm-5.3.3-27.el6_5.x86_64.rpm                 | 1.1 MB     00:00
--------------------------------------------------------------------------------
Total                                           5.1 MB/s | 1.7 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : php-common-5.3.3-27.el6_5.x86_64                             1/2
  Installing : php-fpm-5.3.3-27.el6_5.x86_64                                2/2
  Verifying  : php-fpm-5.3.3-27.el6_5.x86_64                                1/2
  Verifying  : php-common-5.3.3-27.el6_5.x86_64                             2/2

Installed:
  php-fpm.x86_64 0:5.3.3-27.el6_5

Dependency Installed:
  php-common.x86_64 0:5.3.3-27.el6_5

Complete!
[root@w1 nginx]#
[root@w1 nginx]# service php-fpm status
php-fpm is stopped
[root@w1 nginx]# service php-fpm start
Starting php-fpm:                                          [  OK  ]
[root@w1 nginx]#

[root@w1 php-fpm]# yum install php-pecl-apc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.esocc.com
 * extras: mirror.esocc.com
 * updates: mirror.esocc.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-pecl-apc.x86_64 0:3.1.9-2.el6 will be installed
--> Processing Dependency: /usr/bin/pecl for package: php-pecl-apc-3.1.9-2.el6.x86_64
--> Processing Dependency: /usr/bin/pecl for package: php-pecl-apc-3.1.9-2.el6.x86_64
--> Running transaction check
---> Package php-pear.noarch 1:1.9.4-4.el6 will be installed
--> Processing Dependency: php-cli >= 5.1.0-1 for package: 1:php-pear-1.9.4-4.el6.noarch
--> Running transaction check
---> Package php-cli.x86_64 0:5.3.3-27.el6_5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch          Version                 Repository      Size
================================================================================
Installing:
 php-pecl-apc        x86_64        3.1.9-2.el6             base            96 k
Installing for dependencies:
 php-cli             x86_64        5.3.3-27.el6_5          updates        2.2 M
 php-pear            noarch        1:1.9.4-4.el6           base           393 k

Transaction Summary
================================================================================
Install       3 Package(s)

Total download size: 2.7 M
Installed size: 8.7 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): php-cli-5.3.3-27.el6_5.x86_64.rpm                 | 2.2 MB     00:00
(2/3): php-pear-1.9.4-4.el6.noarch.rpm                   | 393 kB     00:00
(3/3): php-pecl-apc-3.1.9-2.el6.x86_64.rpm               |  96 kB     00:00
--------------------------------------------------------------------------------
Total                                           4.8 MB/s | 2.7 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : php-cli-5.3.3-27.el6_5.x86_64                                1/3
  Installing : 1:php-pear-1.9.4-4.el6.noarch                                2/3
  Installing : php-pecl-apc-3.1.9-2.el6.x86_64                              3/3
  Verifying  : php-pecl-apc-3.1.9-2.el6.x86_64                              1/3
  Verifying  : 1:php-pear-1.9.4-4.el6.noarch                                2/3
  Verifying  : php-cli-5.3.3-27.el6_5.x86_64                                3/3

Installed:
  php-pecl-apc.x86_64 0:3.1.9-2.el6

Dependency Installed:
  php-cli.x86_64 0:5.3.3-27.el6_5         php-pear.noarch 1:1.9.4-4.el6

Complete!
[root@w1 php-fpm]#

aliyun 主机修改hostname

1. modify /etc/hosts
[root@AY14032111447fdZ ~]# more /etc/hosts
127.0.0.1 localhost
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
#10.162.90.107 AY14032111447fdZ
10.162.90.107 w1.newhost.com

2.修改/etc/sysconfig/network的hostname一行。
[root@AY14032111447fdZ ~]# vi /etc/sysconfig/network
[root@AY14032111447fdZ ~]# more /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=w1.newhost.com
GATEWAY=218.244.142.242

3. 运行hostname命令
[root@AY14032111447fdZ ~]# hostname w1.newhost.com

4.重新登陆,已经改过来了
[louis@w1 ~]$ hostname
w1.newhost.com
[louis@w1 ~]$ hostname -s
w1



 

PL/SQL计算执行时间 DBMS_UTILITY.get_time

今天一个PL/SQL块里要计算执行时间,google一下DBMS_UTILITY.get_time;
奇怪的是,12c doc里没搜索到这个函数,倒是有一个例子,用法一目了然:

http://st-doc.us.oracle.com/12/121/appdev.121/e17622/tuning.htm#LNPLS881

Example 12-9 inserts the same collection elements into two database tables, using a FOR LOOP statement for the first table and a FORALL statement for the second table and showing how long each statement takes. (Times vary from run to run.)

LNPLS881Example 12-9 Time Difference for INSERT Statement in FOR LOOP and FORALL Statements

DROP TABLE parts1;
CREATE TABLE parts1 (
  pnum INTEGER,
  pname VARCHAR2(15)
);

DROP TABLE parts2;
CREATE TABLE parts2 (
  pnum INTEGER,
  pname VARCHAR2(15)
);

DECLARE
  TYPE NumTab IS TABLE OF parts1.pnum%TYPE INDEX BY PLS_INTEGER;
  TYPE NameTab IS TABLE OF parts1.pname%TYPE INDEX BY PLS_INTEGER;
  pnums   NumTab;
  pnames  NameTab;
  iterations  CONSTANT PLS_INTEGER := 50000;
  t1  INTEGER;
  t2  INTEGER;
  t3  INTEGER;
BEGIN
  FOR j IN 1..iterations LOOP  -- populate collections
    pnums(j) := j;
    pnames(j) := 'Part No. ' || TO_CHAR(j);
  END LOOP;

  t1 := DBMS_UTILITY.get_time;

  FOR i IN 1..iterations LOOP
    INSERT INTO parts1 (pnum, pname)
    VALUES (pnums(i), pnames(i));
  END LOOP;

  t2 := DBMS_UTILITY.get_time;

  FORALL i IN 1..iterations
    INSERT INTO parts2 (pnum, pname)
    VALUES (pnums(i), pnames(i));

  t3 := DBMS_UTILITY.get_time;

  DBMS_OUTPUT.PUT_LINE('Execution Time (secs)');
  DBMS_OUTPUT.PUT_LINE('---------------------');
  DBMS_OUTPUT.PUT_LINE('FOR LOOP: ' || TO_CHAR((t2 - t1)/100));
  DBMS_OUTPUT.PUT_LINE('FORALL:   ' || TO_CHAR((t3 - t2)/100));
  COMMIT;
END;
/

Result is similar to:

Execution Time (secs)
---------------------
FOR LOOP: 5.97
FORALL:   .07

PL/SQL procedure successfully completed.

11.2文档,说明如下:

Syntax

DBMS_UTILITY.GET_TIME 
  RETURN NUMBER;

Return Values

Time is the number of 100th’s of a second from the point in time at which the subprogram is invoked.

Usage Notes

Numbers are returned in the range -2147483648 to 2147483647 depending on platform and machine, and your application must take the sign of the number into account in determining the interval. For instance, in the case of two negative numbers, application logic must allow that the first (earlier) number will be larger than the second (later) number which is closer to zero. By the same token, your application should also allow that the first (earlier) number be negative and the second (later) number be positive.

 

 

convert goldengate to integrated mode

init.ora
*.compatible='11.2.0.3'
*.streams_pool_size=4096m

ext01.prm
--@@TRANLOGOPTIONS ASMUSER SYS@+ASM1, ASMPASSWORD welcome1
--@@TRANLOGOPTIONS DBLOGREADER, DBLOGREADERBUFSIZE 4194304, BUFSIZE 8388608
TRANLOGOPTIONS INTEGRATEDPARAMS (max_sga_size 2048, _LOGMINER_READ_BUFFERS 128, parallelism 16)

create.obey
--ADD EXTRACT ext01, TRANLOG, THREAD 1,  BEGIN NOW
ADD EXTRACT ext01, INTEGRATED TRANLOG, BEGIN NOW

but there is errors when start extract 继续阅读

assert failed: getprop(“ro.product.device”) == “P177F03”

Finding update package...
Opening update package...
Installing update...
assert failed: getprop("ro.product.device") == "<span style="color: #666666; font-family: Consolas;">P177F03</span>" ||
getprop.("ro.build.product") || ... (and so on)
E:Error in /sdcard/#whateverpackage#.zip
Status 7
Installation aborted.

modify recovery image /default.prop

ro.build.product=N983

to

ro.build.product=P177F03
ro.product.customize=JD_P177F03

repack recovery image, done