Hadoop get active namenode

Few hadoop commands to get namenode information

List the namenode hostnames

[email protected][~] hdfs getconf -namenodes
dw-master01.cstest.com dw-master02.cstest.com

Get nameservice name

[email protected][~] hdfs getconf -confKey dfs.nameservices
nameservice1

Get active and standby namenodes

[email protected][~] hdfs getconf -confKey dfs.ha.namenodes.nameservice1
namenode70,namenode95

[email protected][~] hdfs haadmin -getServiceState namenode70
active
[email protected][~] hdfs haadmin -getServiceState namenode95
standby

Read More

slony add tables to existing set

Steps to add new tables to slony replication

In order to add a new table to existing set in slony, we need to create a new set with the table and merge it with the existing set.

  • Before adding the table to slony, verify below things
    • Table exists on the target node.
    • Table has a primary key. Slony doesn’t work without a primary key.
    • It is better to truncate the table on the target node before adding it to slony replication.
  • Verify existing slony configuration. We need to capture below details.
    • Cluster name
    • Source/target node connection info
    • Existing Set ids, Table ids

Cluster name is same as slony schema name without the underscore at the beginning, it is ‘testslony’ in our case.

Source and target node details from below query Read More

Cloning Oracle Grid Infrastructure home and ASM installation

perl clone Oracle GI and ASM installation

This tutorial is meant to work for RHEL/Centos environments. Covered few issues faced during grid software installation

  • TAR binaries and copy, make sure to bring down oracle services before creating tar.
[[email protected] product]# tar -czvf grid_home.tar.gz grid_home
[[email protected] product]$ scp grid_home.tar.gz node4:/u01/app/oracle/product/.
  • Partition disks required for ASM instance – follow procedure here
  • Create oracle OS user under dba group, this user will be owning the grid binaries.
[[email protected] tmp]# groupadd dba
[[email protected] tmp]# useradd -g dba oracle
  • Unzip binaries and setting few system environment variables.
[[email protected] disks]$ cd /u01/app/oracle/product
[[email protected] product]$ tar -xzvf grid_home.tar.gz
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/grid_home
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=+ASM
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
  • Running perl clone

Read More

fix dataguard broker configuration

Steps to rebuild dataguard broker configuration

Issue with dgmgrl configuration

DGMGRL> show configuration;

Configuration - apps

  Protection Mode: MaxPerformance
  Databases:
    appsnew_dca - Primary database
      Error: ORA-16810: multiple errors or warnings detected for the database

    appsnew_vgs - Physical standby database
      Error: ORA-16810: multiple errors or warnings detected for the database

    apps_lax    - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
ERROR

Viewing exact database error Read More

Copy oracle schema from one database to another

Using expdp and impdp tools to backup a user/schema data and restore to another database.

Create a backup directory which will be used by expdp tool

CREATE OR REPLACE DIRECTORY "BACKUP_DIR" AS '/u01/expdp'

Use expdp to take full schema backup

expdp \"/ as sysdba\" schemas=pin2 directory=backup_dir dumpfile=pin2.dmp logfile=pin2.log

Dump file set for SYS.SYS_EXPORT_SCHEMA_02 is:
  /u01/expdp/pin2.dmp
Job "SYS"."SYS_EXPORT_SCHEMA_02" successfully completed at 07:08:14

[email protected][dev02]/u01/expdp>ls 
pin2.dmp         pin2.log

copy the dump file to another server where we need to restore. We need to create a backup_dir on that server and copy dump file to that directory.

CREATE OR REPLACE DIRECTORY "BACKUP_DIR" AS '/u01/expdp'
scp [email protected]:/u01/expdp/pin2.dmp /u01/expdp/.

Start importing the schema to pin3, we need to drop the existing schema if it exists. Read More