Pages

Thursday, December 17, 2015

Data generation for oracle

https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2151576678914


create or replace procedure clone( p_tname in varchar2, p_records in number )
  authid current_user
  as
      l_insert long;
      l_rows   number default 0;
  begin

     execute immediate 'create table clone_' || p_tname ||
                       ' as select * from ' || p_tname ||
                       ' where 1=0';

      l_insert := 'insert into clone_' || p_tname ||
                  ' select ';

      for x in ( select data_type, data_length,
                  rpad( '9',data_precision,'9')/power(10,data_scale) maxval
                   from user_tab_columns
                  where table_name = 'CLONE_' || upper(p_tname)
                  order by column_id )
      loop
          if ( x.data_type in ('NUMBER', 'FLOAT' ))
          then
              l_insert := l_insert || 'dbms_random.value(1,' || x.maxval ||
                                                                        '),';
          elsif ( x.data_type = 'DATE' )
          then
              l_insert := l_insert ||
                    'sysdate+dbms_random.value+dbms_random.value(1,1000),';
          else
              l_insert := l_insert || 'dbms_random.string(''A'',' ||
                                         x.data_length || '),';
          end if;
      end loop;
      l_insert := rtrim(l_insert,',') ||
                    ' from all_objects where rownum <= :n';

      loop
          execute immediate l_insert using p_records - l_rows;
          l_rows := l_rows + sql%rowcount;
          exit when ( l_rows >= p_records );
      end loop;
  end;
  /

grant create procedure to user1;
grant execute any procedure to user1;

scott@TKYTE9I.US.ORACLE.COM> exec clone( 'emp', 5 );

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.01
scott@TKYTE9I.US.ORACLE.COM> select * from clone_emp;

     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ------
      4923 BrCyhfdHaQ mGSqkWMvy       8302 07-SEP-02    2765.67   89231.32     27
       323 ImuBZCYDrt TdjoflvYE       9613 11-AUG-03   82158.44   34478.25     89
      8773 jnTPtKkchC KzUezmTTL       8432 20-MAY-04    29909.7   23860.67     24
      7374 aETDfeptSS ObVBgtnAP       9033 28-MAR-03   34012.77   92188.64     45
      4530 MKGvauUMOQ GXwcRjGUn         51 07-AUG-04    84510.9   93629.66     79

Wednesday, December 16, 2015

change eth1 to eth0

modify
/etc/udev/rules.d/70-persistent-net.rules

Cell Troubleshooting

/opt/oracle/cell12.1.2.1.3_LINUX.X64_151021/log/diag/asm/cell/centos61/trace/
ms-odl.trc

yum repo

Oracle Linux 5
  1. # cd /etc/yum.repos.d
  2. # wget http://public-yum.oracle.com/public-yum-el5.repo

Oracle Linux 6+
  1. # cd /etc/yum.repos.d
  2. # wget http://public-yum.oracle.com/public-yum-ol6.repo

Install Cell

[root@centos61 expri2]# rpm -ivh cell-12.1.2.1.3_LINUX.X64_151021-1.x86_64.rpm
Preparing...                ########################################### [100%]
Pre Installation steps in progress ...
   1:cell                   ########################################### [100%]
Post Installation steps in progress ...
Set cellusers group for /opt/oracle/cell12.1.2.1.3_LINUX.X64_151021/cellsrv/deploy/log directory
Set 775 permissions for /opt/oracle/cell12.1.2.1.3_LINUX.X64_151021/cellsrv/deploy/log directory
/opt/oracle/cell12.1.2.1.3_LINUX.X64_151021/cellsrv/deploy
/opt/oracle/cell12.1.2.1.3_LINUX.X64_151021/cellsrv/deploy
/opt/oracle/cell12.1.2.1.3_LINUX.X64_151021
Installation SUCCESSFUL.
Starting RS and MS... as user celladmin
/tmp/cellstup.sh: line 5: echo: write error: No space left on device
/var/tmp/rpm-tmp.uKJFIX: line 436: [: !=: unary operator expected
/var/tmp/rpm-tmp.uKJFIX: line 441: [: !=: unary operator expected
Done. Please Login as user celladmin and create cell to startup CELLSRV to complete cell configuration.
If this is a manual installation, please stop and restart ExaWatcher to pick up newly installed binaries.
You can run "/opt/oracle.ExaWatcher/ExaWatcher.sh --stop" and then "/opt/oracle.ExaWatcher/ExaWatcher.sh --fromconf" to stop and restart ExaWatcher.
Logout and then re-login to use the new cell environment.

Exadata 硬件

Oracle Exadata Storage Server (11.2.3.1.0)

V31151-01.zipOracle Database Machine Database Host (X4800M2, X4800, X4170M2, X4170) Image 11g Release 2 (11.2.3.1.0) for Linux x86_64
1.4 GB

V31152-01.zipOracle Database Machine Exadata Storage Cell (X4270M2, X4275) Image 11g Release 2 (11.2.3.1.0) for Linux x86_64
1.6 GB


V42777-01.zipOracle Database Machine Exadata Storage Cell (X4-2L, X4270M3, X4270M2, X4275) Image 12c Release 1 (12.1.1.1.0) for Linux x86_64
1.7 GB

V42778-01.zipOracle Database Machine Database Host (X4800M2, X4800, X4-2, X4170M3, X4170M2, X4170) Image 12c Release 1 (12.1.1.1.0) for Linux x86_64
1.3 GB

V42804-01.zipOracle Database Machine Database Host (X4-2, X4170M3, X4170M2, X4170) USB Install 12c Release 1 (12.1.1.1.0) for Solaris x86_64
1.8 GB

V42805-01.zipOracle Database Machine Database Host (X4-2, X4170M3, X4170M2, X4170) ISO Install 12c Release 1 (12.1.1.1.0) for Solaris x86_64
1.8 GB

V77835-01.zipOracle Database Machine Database Host (X5-8, X4-8, X4800M2, X4800, X5-2, X4-2, X4170M3, X4170M2, X4170) PXE Image 12c Release 1 (12.1.2.2.0) for Linux x86_64
2.4 GB

V77836-01.zipOracle Database Machine Exadata Storage Cell (X5-2L, X4-2L, X4270M3, X4270M2, X4275) PXE Image 12c Release 1 (12.1.2.2.0) for Linux x86_6

db:        Sun X4170
cell:      Sun X4275