Search This Blog

Saturday, July 30, 2016

Oracle: EXP-00091 Exporting questionable statistics tips

We can remove the this kind of error like EXP-00091  using  statistics=none or by setting the client character set 

Below is an example 

exp userid= Schema_name/schema_password@db_service_name full=N  statistics=none owner=(Schema_name1, Schema_name2) file=/DATABASE/u01/DB_Schema.dmp log=/DATABASE/u01/ DB_Schema.log

Tuesday, July 26, 2016

Example : Multiple data update in single query in Oracle

For Multiple data update in single query in Oracle , following example can be used:


Update Table1 a
set (a.NAME) = (select b.NAME
                                  from Table2 b
                                  where b.id = a.id)

Create Segment using database procedure in Oracle

CREATE OR REPLACE PROCEDURE DATA_SEGMENT_ORCL IS
            cursor all_tab is select distinct table_name
            from SYS.ALL_TABLES
            where owner='YOUR_SCHEMAA' and SEGMENT_CREATED = 'NO';
               
           v_str_or Varchar2(2000);
                   v_err Varchar2(3000);
        BEGIN
         
         
        for i in all_tab loop
                   
            v_str_or :='ALTER TABLE '||i.table_name|| ' ALLOCATE EXTENT';
           
                          begin
                         
                          execute immediate v_str_or;
                         
                         
                           EXCEPTION
                             WHEN others THEN
                                  v_err:=sqlerrm;
                                   --insert into A_ERROR_ALTER(TBLE_NAME, ERR_CODE) Values (i.table_name,v_err);
                                   commit;
                                  -- Null;
                            end;    
                           
                  v_str_or:='';
                     
            end loop;
           
       
                 
           
        END ;

PHP : Short format of starting and ending scope

To use short format of  starting and ending scope in PHP like <? echo "Hello"; ?>
we have to change the paarmeter
short_open_tag=On

from /etc/php.ini file.

If we use short_open_tag=Off, we have to use  <?php  echo "Hello"; ?> .


MYSQL data process error: "The total number of locks exceeds the lock table size"

To solve the problem, please add below line  under the [mysqld] in /etc/my.cnf file. I have used

 innodb_buffer_pool_size=4256M

After that we have to execute the command from root user.

#service mysqld restart

Delete duplicate row in MYSQL database example

To delete duplicate rows in MYSQL database, we can use below query:


DELETE n1 FROM TABLE_A n1, TABLE_B n2
         WHERE n1.id > n2.id AND n1.emp_code = n2.emp_code AND n1.attnd_date = n2.attnd_date
          AND n1.attnd_date>='2016-01-11' AND n1.attnd_date<='2016-01-20'
          

Create table from another table in SQL SERVER Example

To create a table from another table SQL SERVER database with all data, following example can be used:

"Select * into NewNanoTable from OldNanoTable"

Following is also used:

 "Insert into  TABLE2
SELECT *
FROM TABLE1"