Custom Search
www.rocket99.com : Technical Guides Sybase Oracle UNIX Javascript


Technical Guides
Sybase
Oracle
UNIX
Javascript




Of Interest

Business Intelligence and Analytics



Oracle Training





Sybase » Administration » DBA » Sybase IQ

Sybase IQ : Moving / Re-allocating / Re-org

     

Use these procedures to monitor the level of fragmentation for each table.
 sp_iqrowdensity
 
 sp_iqindexfragmentation
 
 
It is best to relocate table when fragmentation is excessive, or when new dbspaces are added to the system. In IQ 12.X sp_iqrelocate had been used to move tables .. but in IQ 15.X this is replaced with alter table.
 -- IQ 12.7, relocate table to other dbspaces which are writable
 
 commit;
 
 alter dbspace IQ_SYSTEM_MAIN relocate ;
 
 commit;
 
 sp_iqrelocate 'table StoreInvoices';
 
 commit;
 
 
 -- IQ 15.X, relocate the table directly
 
 alter table StoreInvoices move to Main005 ;
 
 
Alternate method: Using iq_rebuildindex, you can relocate tables a column at a time by rebuilding the FP index.
 
 -- rebuild / relocate dept_id column
 
 sp_iqrebuildindex 'employee', 'column dept_id';
 
 
 -- rebuild / relocate all columns on employee table
 
 sp_iqrebuildindex 'employee', 'column dept_id column first_name column last_name column salary column resume column hire_date';
 
 
Here's a handy Perl program, which generates the rebuildindex commands for a given table (DDL file is required) ..
 
 #!/usr/bin/perl
 #==================================================================
 #  rebuildindex.pl
 #
 #  Generate sp_iqrebuildindex commands, for table rebuilds
 #
 #  Batches the columns in groups of 24
 #
 #  Parms:  ddlfile  tablename
 #
 #  ./rebuildindex.pl   employee.sql   employee
 #==================================================================
 
 $fname1 = $ARGV[0];
 $tname  = $ARGV[1];
 $fname2 = $tname . '.rebuildindex.sql' ;
 
 print "\n\n  Processing DDL file ... \n\n" ;
 
 open(FILE1,"<$fname1") or die "ERROR - file1 \n\n\n" ;
 open(FILE2,">$fname2") or die "ERROR - file2 \n\n\n" ;
 
 $i = 0;
 $j = 0;
 $print_ind = 0 ;
 $line2 = ' ' ;
 
 print FILE2 "commit; \n\n"  ;
 
 while ()
 {
 $line1 = $_ ;
 chomp $line1 ;
 
 $line1 =~ s/\t/  /g ;
 $line1 =~ s/^\(/ / ;
 $line1 =~ s/^ +// ;
 
 if (  ($line1 =~ /^go/) || ($line1 =~ /^\)/)  )
     { $print_ind = 0 ; }
 
 
 if ( ($line1 =~ /constraint/i) || ($line1 =~ /primary/i) || ($line1 =~ / ZZZ /)  )
         { $line1 = '' ; }
 
    # print $line1 . "\n" ;
 
 if ( ($print_ind eq 1) && ($line1 =~ /[a-z]/i) )
    {
    $line1 =~ s/,/  /g ;
    @line1 = split ' ', $line1 ;
 
    $col = shift @line1 ;
 
    $i++ ;
    $j++ ;
 
 
    $col = 'column ' . $col . ' ' ; ;
 
    $line2 = $line2 . $col ;
 
    if ($i > 24)
       {
       print FILE2 "sp_iqrebuildindex " . "'" . $tname . "','"  ;
       print FILE2 $line2 . "'; \n\n" ;
       print FILE2 "commit; \n\n"  ;
 
       $line2 = ' ' ;
       $i = 0 ;
       }
    }
 
 if   ($line1 =~ /create table/i)
     { $print_ind = 1 ; }
 
 }
 
 
 if ($i > 0)
       {
       print FILE2 "sp_iqrebuildindex " . "'" . $tname . "','"  ;
       print FILE2 $line2 . "'; \n\n" ;
       print FILE2 "commit; \n\n"  ;
       }
 
 
 close(FILE1);
 close(FILE2);
 
 print "\n\n  Processing DDL file ... DONE ... $fname2\n\n" ;
 
 






Sybase : Related Topics

Sybase : Administration : Post-installation check
Sybase : Administration : Device initialization
Sybase : Administration : Database Creation
Sybase : Administration : A backup routine
Sybase : Administration : Striping Dump Devices
Sybase : Administration : Moving the transaction log to another device
Sybase : Administration : Adding a segment to a database
Sybase : Administration : Configuring the cache
Sybase : Administration : Apply multiple transaction dumps
Sybase : Administration : Database maintenance procedure
Sybase : Administration : Database maintenance script
Sybase : Administration : Server configuration
Sybase : Administration : Dealing with a Corrupted Database
Sybase : Administration : Dealing with a Server Failure
Sybase : Administration : DBCC Notes
Sybase : Administration : Create proxy tables and external logins
Sybase : Administration : Renaming a database
Sybase : Administration : Reorg: rebuilding a table
Sybase : Administration : Sybase ASE 15 Enhancements
Sybase : Administration : Setting the thresholds
Sybase : Administration : Apply a transaction dump
Sybase : Administration : Security Tasks
Sybase : Administration : Setting Process Priorities
Sybase : Administration : Sybase ASE Architecture Overview
Sybase : Administration : Drop an alias, with objects linked to login
Sybase : Administration : Display grants, effective rights to objects
Sybase : Administration : Displaying access information from sysprotects
Sybase : Administration : Database Engines: Status and Settings
Sybase : Administration : Replication Server 15 Configuration
Sybase : Administration : Loading data into Sybase IQ from a Remote Server
Sybase : Administration : Sybase IQ Overview
Sybase : Administration : Sybase IQ Functions
Sybase : Administration : Sybase IQ - Remote Access From ASE
Sybase : Administration : Sybase IQ : Procedure Profiling / Monitoring
Sybase : Administration : Sybase IQ: Restoring a Database from Dump Files
Sybase : Administration : Sybase IQ: Minimize Storage option
Sybase : Administration : Sybase IQ: Index Types
Sybase : Administration : Sybase IQ: HUGEPAGE Support
Sybase : Administration : Sybase IQ: Database Creation (Raw Devices)
Sybase : Administration : Sybase IQ : Repairing Problems / Troubleshooting Corruption
Sybase : Administration : Sybase IQ: Sysmon / System Performance Analysis
Sybase : Administration : Sybase IQ: Monitoring Connections / Processes
Sybase : Administration : Sybase ASE: Installing a new server via srvbuildres utility
Sybase : Administration : Sybase IQ: Copying users/logins between databases
Sybase : Administration : Sybase IQ: Managing User Accounts
Sybase : Administration : Sybase ASE: Database Schema Compare
Sybase : Administration : Sybase IQ: Listing tables, ordered by size allocated
Sybase : Administration : Sybase IQ : Comparing grants / permissions between servers
Sybase : Administration : Sybase ASE: Database page size
Sybase : Administration : Sybase ASE: Managing users and roles
Sybase : Administration : Sybase ASE: Setting resource limits for users
Sybase : Administration : Sybase ASE: Setting up user assigned custom tempdbs
Sybase : Administration : Sybase ASE: Setting up the transaction log cache using logiosize
Sybase : Administration : Sybase IQ: Server Startup Switches
Sybase : Administration : Sybase ASE: Managing Identity Columns
Sybase : Administration : Sybase IQ: Working with options and server settings
Sybase : Administration : Sybase IQ: Monitoring and Troubleshooting via System Procedures

Sybase Web Site
Sybase iAnywhere Mobile Web Site
Oracle Enterprise Web Site



Get the latest Rocket99 news and tech tips via






Site Index About this Guide to Sybase, Oracle, and UNIX Contact Us Advertise on this site




Copyright © 2016 Stoltenbar Inc All Rights Reserved.