Monday, September 12, 2016

Drop table error due to constraints [ ERROR due to ORA-02449: unique/primary keys in table referenced by foreign keys ]

Before drop the table If any constraints exsits drop the constraints by using the below query

else If you want to drop all the constraints and table use below query

drop table <table_name> cascade constraints

eg: drop table sample cascade constraints

It will drop all the constraints and table as well.



Friday, August 26, 2016

DEBUG THE CODE WITH ORACLE SQL DEVELOPER CLIENT


DEBUG THE CODE WITH ORACLE SQL DEVELOPER CLIENT

before debugging,  run the below commands in command line to enable debugging.

alter session set PLSQL_DEBUG=TRUE

execute DBMS_DEBUG_JDWP.CONNECT_TCP('XX.XX.XX.XXX',1521);


provide the connection detials above and press ok

After that start debuging.



Wednesday, June 15, 2016

Oracle - Kill Locked Sessions

Oracle - List Locked Sessions :-

SELECT    DO.owner
        , DO.object_name
        , DO.object_type
        , vs.SID
        , vs.serial#
        , vs.status
        , vs.osuser
        , vs.machine
        , vs.program
        , vs.module
        , vs.action
    FROM  v$locked_object vlo
        , v$session vs
        , dba_objects DO
   WHERE
        vs.SID = vlo.session_id
        AND vlo.object_id = DO.object_id
ORDER BY module

Oracle - Kill Locked Session :-

alter system kill session 'SID,serial#'
alter system kill session '145,47805'

Wednesday, January 6, 2016

ORACLE DATABASE : Replication Problem with Auto Increment value

ORACLE DATABASE : 

While replication, When auto increment value exists same value in other table as well. 

To adjust to max Auto increment value use the below query.


STOP Auto_increment turn it to OFF. Insert MAX value then start turn it to ON

EXAMPLE :

SET IDENTITY_INSERT Yaks ON INSERT INTO dbo.Yaks (YakID, YakName) Values(1, 'Mac the Yak') SET IDENTITY_INSERT Yaks OFF SELECT * from yaks 

Thursday, December 17, 2015

Restart Python Script



Restart Python Script :

python = sys.executable
 os.execl(python, python, * sys.argv)

IDE for Python

IDE for Python : for python Development , Pycharm IDE is easy to write the python script.

Link : https://www.jetbrains.com/pycharm/

Wednesday, December 9, 2015

Design Patterns

Design Patterns :


Strategy Pattern : The strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
Eg: with different strategies we can pay the bill via credit card,debit card,online payment etc.. each is having different algorithm.

Singleton Pattern : Ensures a class has only one instance and provides global point of access to it.

Factory Pattern : Defines an interface for creating an object, but lets sub class decide which class to instantiate. Factory method lets a class defer instantiation to subclasses.

Abstract Factory Pattern : Provides an interface for creating family of related or dependent objects without specifying their concrete classes.

Observer Pattern : Defines one to many dependency between objects so that when one object changes all its dependants are notified and updated automatically.

Facade pattern
the Facade pattern helps manage complexity by providing a simple interface to a complicated system, making the client’s job easier and the codebase more manageable.

Why It’s Useful

  • Reduces complexity for the client by hiding intricate subsystem details.

  • Promotes loose coupling between client and subsystems.

  • Improves maintainability by centralizing subsystem interactions in one place.

  • Makes the system easier to use and understand.

When to Use It

  • When you want to simplify interactions with complex subsystems.

  • When you want to decouple clients from subsystem classes.

  • When you want a single entry point to a set of functionalities.


Singleton Pattern Example Code:

#include <iostream>
using namespace std;

class singleton
{
    private:
    static singleton *sptr;
    singleton(){}
    singleton(singleton &s);
    singleton operator =(singleton &s);
    public:
    static singleton* GetInstance();
};
singleton *singleton::sptr=NULL;

singleton* singleton::GetInstance()
{
 if(sptr==NULL)
 {
  sptr= new singleton();
  return sptr;
 }
 else
 {
  return sptr;
 }
}
int main() {
// your code goes here
singleton *ptr1 =singleton::GetInstance();
cout<<ptr1<<endl;
singleton *ptr2 =singleton::GetInstance();
cout<<ptr2;
return 0;
}


Note : Article is in Progress.

lvalue vs rvalue

  1. What is an lvalue? An lvalue is an object that: Has an identifiable memory location. Has a name (in most cases). Can appear on th...