Santosh's profileSantosh KumarPhotosBlogListsMore Tools Help

Blog


    Oracle, Error ORA-01033: ORACLE initialization or shutdown in progress


    There are many reasons for this error. One of these reasons is file corruption, which needs media recovery. The following steps can help
     
    ...1. Go Start Menu -> Run -> Cmd -> OK
     
    ...2. Give the following commands for shutting down oracle
     
    C:\> SQLPLUS /NOLOG
    SQL> CONNECT SYS/PWD AS SYSDBA
    SQL> SHUTDOWN ABORT
    SQL> EXIT
     
    ...3. Now check and fix the drive in which oracle is installed
     
    C:\> CHKDSK <DRIVE_NAME>: /F
     
    ...4. Go again to oracle and recover database
     
    C:\> SQLPLUS /NOLOG
    SQL> CONNECT SYS/PWD AS SYSDBA
    SQL> RECOVER DATABASE
    SQL> STARTUP
    SQL> EXIT
     
    ...5. All the best 
     
    »»»»»»»   by Santosh Kumar
     ?
    Original @ http://santu4you.spaces.live.com 
     

    Oracle, The beauty while using UNION

    Every time just de-normalizing data cannot satisfy the understanding of information. Many times it requires proper heading and branching for putting the information on a report. That’s why people use to hard code each and every report. But I feel, if brain is applied properly query alone can give all kind of presentation of the data.
     
    SQL> SELECT * FROM EMP;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
    ---------- ---------- --------- ---------- --------- ---------- ---------- ----------
          7369 SMITH      CLERK           7902 17-DEC-80       -800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT      ANALYST         7566 09-DEC-82       3000     5000.5         20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 12-JAN-83       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
     
    14 ROWS SELECTED.
     
    SQL> SELECT * FROM DEPT;
     
    DEPTNO DNAME          LOC
    ---------- -------------- -------------
            10 ACCOUNTING     NEW YORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
     
    3 ROWS SELECTED.
     
    SQL> SELECT NAME, JOB, SAL, EMPNO FROM(
       2    SELECT 3 ORD, DEPTNO, ENAME NAME, JOB, SAL, EMPNO FROM EMP
       3    UNION
       4    SELECT 1 ORD, DEPTNO, DNAME NAME, NULL, NULL, NULL FROM DEPT
       5    UNION
       6    SELECT 2 ORD, DEPTNO, SUBSTR(LPAD('-',20,'-'),1,20) NAME, NULL, NULL, NULL FROM DEPT
       7    UNION
       8    SELECT 4 ORD, DEPTNO, NULL NAME, NULL, NULL, NULL FROM DEPT
       9  ORDER BY DEPTNO, ORD
      10 /
     
    NAME                 JOB              SAL      EMPNO
    -------------------- --------- ---------- ----------
    ACCOUNTING
    --------------------
    CLARK                MANAGER         2450       7782
    MILLER               CLERK           1300       7934
    KING                 PRESIDENT       5000       7839
     
    RESEARCH
    --------------------
    ADAMS                CLERK           1100       7876
    SMITH                CLERK           -800       7369
    SCOTT                ANALYST         3000       7788
    FORD                 ANALYST         3000       7902
    JONES                MANAGER         2975       7566
     
    SALES
    --------------------
    ALLEN                SALESMAN        1600       7499
    WARD                 SALESMAN        1250       7521
    TURNER               SALESMAN        1500       7844
    BLAKE                MANAGER         2850       7698
    JAMES                CLERK            950       7900
    MARTIN               SALESMAN        1250       7654
     
    »»»»»»»   by Santosh Kumar ? Original @ http://santu4you.spaces.live.com 

    Structured System Analysis and Design

    - SSAD
    +--- Definition of a System
    |  +--- A group of Interacting elements that constitutes a whole
    |  +--- An organised set of units which produces the optimum results
    +--- Characteristics of a System
    |  +--- Organisation
    |  +--- Interdependance
    |  +--- Interaction with environment
    |  +--- Central Objectives
    +--- Parts of a System
    |  +--- Elements/Units
    |  +--- Input
    |  +--- Output
    +--- Categories of a System
    |  +--- Closed/Stable System
    |  +--- Open/Adaptable System
    |  +--- Information System
    |     +--- It's contineous
    |     +--- Designed as per user's request
    |     +--- Output given to the user for further verification
    |     +--- Categories
    |        +--- Transaction Processing System {Low Level}
    |        +--- Management Information System {Mid Level}
    |        +--- Decision Support System {Top Level}
    +--- Development Techniques of a System
       +--- System Development Life Cycle {SDLC}
       |  +--- It contains several phases in development cycle
       |  +--- Also a sequencial forwarding
       |  +--- Can jump back at any stage
       |  +--- Phases of SDLC
       |     +--- Preliminary Investigations
       |     |  +--- It's a verification of user's request
       |     |  +--- Clarity of the requirement is confirmed
       |     |  +--- Most urgent requirements are picked first
       |     +--- Information Gathering
       |     |  +--- Interview
       |     |  +--- Questionnaire
       |     |  +--- Record Inspection
       |     |  +--- Observation
       |     +--- Feasibility Study
       |     |  +--- Technical
       |     |  +--- Financial
       |     |  +--- Operational
       |     +--- System Analysis
       |     +--- System Design
       |     |  +--- Methodology
       |     |  |  +--- Structured Design
       |     |  |  +--- Form Driven Design
       |     |  +--- Parts
       |     |     +--- Input Design
       |     |     +--- Output Design
       |     |     |  +--- Information Report
       |     |     |  +--- Summary Report
       |     |     |  +--- Exception Report
       |     |     |  +--- Turnaround Document {Acts as an input}
       |     |     +--- File/Database Design
       |     |        +--- Storage and Retrival
       |     |        |  +--- Normalisation
       |     |        |  +--- Denormalisation
       |     |        +--- Table Design
       |     |           +--- Master File
       |     |           |  +--- Static
       |     |           |  +--- Dynamic
       |     |           +--- Transaction File
       |     |           +--- Work File {temp file}
       |     |           +--- Audit File {tracking file}
       |     +--- Coding
       |     +--- Testing
       |     |  +--- Alpha testing
       |     |  +--- Beta testing
       |     |  +--- Unit testing
       |     |  +--- Integraded testing
       |     +--- Integration
       |     +--- Implementation
       |     |  +--- Direct Implementation {NEW=>}
       |     |  +--- Parallel Implementation {NEW=> OLD=>}
       |     |  +--- Pilot Implementation {ONE SECTION OF AN ORGANISATION}
       |     |  +--- Phase Implementation {ONE SECTION OF A PROGRAM}
       |     +--- Evaluation
       +--- System Analysis Development {SAD}
       |  +--- System is devided into several component
       |  +--- Each is analised indivisually
       |  +--- Analysis and Documentation tools
       |     +--- Decision Table
       |     |  +--- [11] Condition Stub [Options]
       |     |  +--- [12] Condition Entry [Y/N]
       |     |  +--- [21] Action Stub [Clauses]
       |     |  +--- [22] Action Entry [X]
       |     +--- Decision Tree
       |     +--- Structured English
       |        +--- An English like language use to describe the logic
       |        +--- Types are
       |           +--- Sequential
       |           +--- Selection
       |           +--- Iteration
       +--- System Prototype
          +--- A working model of a system
          +--- Required when users themselves do not know their requiremnet
          +--- Types
             +--- Data Modeling {Entity Relation Diagram}
             |  +--- It involves the data like input, stored, processed, produced
             |  +--- Used for data handling and its relationship
             |  +--- Components are
             |     +--- Entity
             |     |  +--- Person
             |     |  +--- Car
             |     +--- Attributes
             |     |  +--- Person
             |     |  |  +--- Name
             |     |  |  +--- Age
             |     |  |  +--- Address
             |     |  +--- Car
             |     |  |  +--- Manufacturer
             |     |  |  +--- Model
             |     |  |  +--- Price
             |     +--- Relationship
             |        +--- One to One {Driver<==>License Student<==>Rollno}
             |        +--- One to Many {Student<==>Subjects Cutomer<==>Orders}
             |        +--- Many to Many {Student<==>Teacher Project<==>Employees}
             +--- Process Modeling {Data Flow Diagram}
                +--- Used to pictorially depict the entire processing
                +--- Traces data flow through different process with symbols
                +--- Components are
                |  +--- Entity
                |  +--- Process
                |  +--- Data store
                |  +--- Data Flow
                +--- Levels are
                   +--- 1st level DFD {Only entities are shown}
                   +--- 2nd level DFD {Entities and Process are shown}
                   +--- 3rd level DFD {Entities, Process and Data Stores are shown}
     
    »»»»»»»   by Santosh Kumar ? Original @ http://santu4you.spaces.live.com

    Oracle, Date & Time Arithmetic

    With very few functions oracle has provided every thing needed for doing all kind of arithmetic with date and time. Most of the thing are possible just with to_date() and to_char(). Have a look on the following statements.
     
    SQL> select 'Current Date and Time is' Detail, to_char(sysdate,'dd-mm-yyyy hh24:mi:ss') Output from dual
      2  union all
      3  select 'Add 2 Seconds', to_char(sysdate+(1/24/60/60)*2,'dd-mm-yyyy hh24:mi:ss') from dual
      4  union all
      5  select 'Add 2 Minutes', to_char(sysdate+(1/24/60)*2,'dd-mm-yyyy hh24:mi:ss') from dual
      6  union all
      7  select 'Add 2 Hours', to_char(sysdate+(1/24)*2,'dd-mm-yyyy hh24:mi:ss') from dual
      8  union all
      9  select 'Add 2 Days', to_char(sysdate+(1)*2,'dd-mm-yyyy hh24:mi:ss') from dual
     10  union all
     11  select 'Add 2 Months', to_char(add_months(sysdate,1*2),'dd-mm-yyyy hh24:mi:ss') from dual
     12  union all
     13  select 'Add 2 Years', to_char(add_months(sysdate,12*2),'dd-mm-yyyy hh24:mi:ss') from dual
     14  union all
     15  select 'Today is', to_char(sysdate,'Day') from dual
     16  union all
     17  select 'Tommorow is', to_char(sysdate+1,'Day') from dual
     18  union all
     19  select 'Coming Monday is on', to_char(next_day(sysdate,'MON'),'dd-mm-yyyy') from dual
     20  union all
     21  select 'Last day of the Month is', to_char(last_day(sysdate),'dd-mm-yyyy') from dual
     22  union all
     23  select 'Last Monday of the Month is', to_char(next_day(last_day(sysdate)-7,'MON'),'dd-mm-yyyy') from dual
     24  union all
     25  select 'Last Monday of the Year is', to_char(next_day(last_day(to_date('12','MM'))-7,'MON'),'dd-mm-yyyy') from dual
     26  /
     
    DETAIL                      OUTPUT
    --------------------------- -------------------
    Current Date and Time is    17-03-2009 15:48:57
    Add 2 Seconds               17-03-2009 15:48:59
    Add 2 Minutes               17-03-2009 15:50:57
    Add 2 Hours                 17-03-2009 17:48:57
    Add 2 Days                  19-03-2009 15:48:57
    Add 2 Months                17-05-2009 15:48:57
    Add 2 Years                 17-03-2011 15:48:57
    Today is                    Tuesday
    Tommorow is                 Wednesday
    Coming Monday is on         23-03-2009
    Last day of the Month is    31-03-2009
    Last Monday of the Month is 30-03-2009
    Last Monday of the Year is  28-12-2009
     
    13 rows selected.
     
    SQL> 

     
    »»»»»»»   by Santosh Kumar
     ?
    Original @ http://santu4you.spaces.live.com