Jan 20 2016

MsSQL Server Unknown Server Hostname Problem Solution

Category: Administration,Errors and SolutionsFatih Acar @ 12:25

When you try to connect MsSQL Server database, you can get an error that is Unknown Server Hostname or similar sometimes. You can resolve this problem with a few operation.

Suggest

If you use SERVERNAME\INSTANCENAME statement, you can try SERVERNAME;instance=INSTANCENAME statement

311 total views, 15 views today

Tags: Database Administration, MsSQL Server, MsSQL Server Error and Solutions


Jan 12 2016

Oracle 11g Data Guard Failover With Python Script

Category: Administration,Backup And Recovery,Linux & Unix,PythonFatih Acar @ 10:56

I wrote a python script to perform failover steps and to take product database IP addresses when product database is down. If you dont use data guard broker or other application for failover operations, you can use this script for failover. My scenario is that I have Oracle 11gR2 2 nodes RAC product database and 1 node standby real time apply type data guard database. When the product database is fail, the data guard database can run as product database with take product database IP addresses and service name. Python script will do all steps that take product IP address, take product service name, perform failover steps.

I made test when data guard was archivelog apply type, script could run correctly.

Systems

Product Database : Oracle 11g R2 (11.2.0.3) RAC
Data Guard : Oracle 11g R2 (11.2.0.3) Single Instance With Grid Infrastructure
Operating System : Oracle Linux 6.6
Data Guard Type : Real Time Apply From Redo Logs
Script Name : failover.py

Python script file is failover.py .Firstly, we have to change parameters in script. You can use vi editor. I generally create python files under /opt/scripts directory.

failover_parameters

Script has 3 types take virtual IP process. If you can not see product virtual IP address when you run ifconfig command after run failover.py script, you can use other type virtual IP process.

The product database is fail. We have to run data guard database like product database. We can use failover.py script.

Run failover.py

[root@dg scripts]# python failover.py

runfailover

If all parameters are correct, you can write “evet” and push enter.

Continue reading “Oracle 11g Data Guard Failover With Python Script”

1,201 total views, 30 views today

Tags: Database Administration, Oracle Administration, Oracle Backup and Restore, Oracle Data Guard Failover, Oracle Failover


Dec 04 2015

RPM Command Using on Linux Systems

Category: Linux & UnixFatih Acar @ 15:46

If you connect linux repo, you can use yum install or yum update to manage your package. On the other hand, if you have RPM package, you can use rpm command to manage packages.

RPM command has been using for installing, uninstalling, upgrading, listing,querying and checking RPM packages on linux system. You can use rpm command with root user.

Frequently Used RPM Commands

Install RPM Package

[root #] rpm -ivh postgresql-libs-8.4.20-1.el6_5.x86_64.rpm

Update RPM Package

[root #] rpm -Uvh postgresql-libs-8.4.20-1.el6_5.x86_64.rpm

List All Installed Packages

[root #] rpm -qa

Search From Installed Packages

[root #] rpm -qa | grep postgresql-libs

Take Information From Installed Package

[root #] rpm -qi postgresql-libs

Uninstall RPM Package

[root #] rpm -ev postgresql-libs

605 total views, 15 views today

Tags: Linux Administration, Oracle Linux, System Administration


Dec 02 2015

Move Datafiles Of Tablespaces With RMAN Set Newname in Oracle 11g

Category: Administration,Backup And RecoveryFatih Acar @ 17:30

You can move datafiles of tablespaces. Scenarios can be asm to file system or file system to file system or file system to file system or asm to asm. Below operations show how to move datafiles. You have to take a backup and database has to be archivelog mode before this operations because of that you do restore and recover operation.

Steps

1 – Database has to be Archivelog Mode
2 – Take Full Rman Backup
3 – Execute Rman Run block

Run Block Description:
Offline Tablespace.
Set Newname.
Restore Datafile To New Location.
Write New Location information to controlfile with switch datafile all.
Recover Datafile.
Online Tablespace.

articleIcon

List Tablespaces

SQL> select tablespace_name from dba_tablespaces;

List Datafile Directories

SQL> select tablespace_name,file_name from dba_data_files;

Move Datafile From Asm To File System

RMAN> RUN {
SQL ‘ALTER TABLESPACE USERS OFFLINE IMMEDIATE’;
SET NEWNAME FOR DATAFILE ‘+DATA/dg/datafile/USERS.329.896267113’ TO ‘/tmp/USERS.329.896267113’;
RESTORE TABLESPACE USERS;
SWITCH DATAFILE ALL;
RECOVER TABLESPACE USERS;
SQL ‘ALTER TABLESPACE USERS ONLINE’;
}

Move Datafile From File System To From Asm
Continue reading “Move Datafiles Of Tablespaces With RMAN Set Newname in Oracle 11g”

841 total views, 30 views today

Tags: Database Administration, Oracle, Oracle Administration, Oracle Backup and Restore, Oracle Rman Backup, Oracle Rman Restore


Nov 15 2015

Auto Increment Primary Key With Trigger in Oracle 11g

Category: Administration,Procedure,SQLFatih Acar @ 14:50

You can provide auto increment primary with trigger by appling below operations.

Create Table

SQL> CREATE TABLE TESTUSER.TBL_TEST
(id number primary key,
name varchar2(100));

Create Sequence

SQL> CREATE SEQUENCE TESTUSER.SEQ_TEST_ID
START WITH 1
MAXVALUE 999999999
MINVALUE 1
CYCLE
NOCACHE
NOORDER;

Create Trigger For Auto Increment

SQL> CREATE OR REPLACE TRIGGER TESTUSER.TRG_AUTO_INC_TEST_ID
before insert on TESTUSER.TBL_TEST
for each row
begin
if inserting then
if :NEW.”ID” is null then
select TESTUSER.SEQ_TEST_ID.nextval into :NEW.ID from dual;
end if;
end if;
end;
/

Oracle 12c release has primary key auto increment feature with identity type column. You can use like below.
Continue reading “Auto Increment Primary Key With Trigger in Oracle 11g”

637 total views, 20 views today

Tags: Database Administration, Oracle, Oracle Administration, Oracle SQL Query


Oct 02 2015

How to Create Virtual IP Address on Oracle Linux System

Category: Linux & UnixFatih Acar @ 16:50

You can create virtual IP addresses on Oracle Linux, Redhat and Centos Operating Systems with below operations.

Virtual IP address can be temporary or static according to your wishes. You have to have a ethernet adaptor interface for example eth0. You can use ifconfig eth0:0 <IP address> syntax to create temporary virtual IP.

Create Temporary Virtual IP

[root@test ~]# ifconfig eth0:0 192.168.27.150

Delete Temporary Virtual IP

[root@test ~]# ifconfig eth0:0 down

Create Static Virtual IP

[root@test ~]# cd /etc/sysconfig/network-scripts
[root@test ~]# vi ifcfg-eth0:0

DEVICE=eth0:0
IPADDR=192.168.27.150
NETMASK=255.255.255.0
NETWORK=192.0.0.0
BROADCAST=192.168.27.255
ONBOOT=yes

Activate Network Configuration

[root@test ~]# service network restart

3,095 total views, 20 views today

Tags: Linux Administration, Oracle Linux, System Administration


Jul 01 2015

How to Move Datafiles to New Disk in MsSQL Server 2008

Category: AdministrationFatih Acar @ 15:38

If database data disk space is full or you have another problem about of disk, you can move datafiles to new disk in MsSQL Server 2008 database.

Show Current Paths and Names

use master
go
select name,physical_name from sys.master.files where database_id = DB_ID(‘DATABASENAME’)
dbf1 D:\OLDLOCATION\disk_1.mdf
dbf1_log D:\OLDLOCATION\disk1_log.ldf
go

Shutdown Database

use master
go
alter database DATABASENAME modify file(dbf1,filename=’E:\NEWLOCATIOB\disk_1.mdf’);
go
alter database DATABASENAME modify file(dbf1_log,filename=’E:\NEWLOCATIOB\disk1_log.ldf’);

Move Datafiles to New Disk
Continue reading “How to Move Datafiles to New Disk in MsSQL Server 2008”

1,901 total views, 5 views today

Tags: Database Administration, MsSQL Server


May 28 2015

How to Migrate Controlfile From File System to ASM Disk in Oracle 11g

Category: Administration,Backup And RecoveryFatih Acar @ 13:36

You can migrate controlfile from file system to asm disk. You have to stop database and you can do that.

Stop Database

SQL> shutdown immediate;
SQL> startup nomount;

Migrate Controlfile

RMAN> restore controlfile to ‘+DATA’ from ‘/tmp/controlfile_currentlocation.ctl’;
RMAN> restore controlfile to ‘+FRA’ from ‘/tmp/controlfile_currentlocation.ctl’;

Continue reading “How to Migrate Controlfile From File System to ASM Disk in Oracle 11g”

2,556 total views, 5 views today

Tags: Oracle, Oracle Administration, Oracle Backup and Restore


Apr 10 2015

How to Delete psql Command Prompt History in PostgreSQL

Category: AdministrationFatih Acar @ 09:56

When you use psql command prompt, system automaticly saves your prompts. If you use password when user creates operation, this situation can occur security risk. Therefore, you can delete this prompts with editing psql_history file like below.

Find And Delete psql Prompts

[root@pg ~]# locate .psql_history
/var/lib/pgsql/.psql_history
[root@pg ~]# vi /var/lib/pgsql/.psql_history

7,301 total views, 30 views today

Tags: PostgreSQL, PostgreSQL Administration


Mar 25 2015

How to Change SSH Port When Selinux is Enable on Oracle Linux 7

Category: Linux & Unix,System SecurityFatih Acar @ 15:47

SSH service runs on 22 port number. You can change this port number for security. If you use Oracle Linux 7, Centos 7 or Red Hat Linux 7 versions, you can change port number with below operations. If selinux is enabled, you have to add new port number to selinux configuration because of the fact that selinux allows only 22 port number for ssh connections.

Step 1 : Change Port Number

[root #] vi /etc/ssh/sshd_config
Port 2290

Save and Exit

Step 2 : Change Selinux Configuration

To change:
[root #] semanage port -a -t ssh_port_t -p tcp 2290
To list:
[root #] semanage port -l | grep ssh

Step 3 : Add New Port to Firewall

To Add:
[root #] firewall-cmd –permanent –zone=public –add-port=2290/tcp
To Activate
[root #] firewall-cmd –reload

Step 4 : Restart SSHD Service to Activate New SSH Confiuration

[root #] systemctl restart sshd.service

Step 5 : Show Running SSH Port

[root #] ss -tnlp | grep ssh

4,420 total views, 10 views today


Next Page »