Problem will be fixed.
Search This Blog
Wednesday, 30 November 2016
“Login Failure: the target account name is incorrect” on a Windows file share
Problem will be fixed.
Shink log file in sql server 2008 r2
USE alphago;
GO -- Truncate the log by changing the database recovery model to SIMPLE. ALTER DATABASE AdventureWorks2008R2
SET RECOVERY SIMPLE; GO -- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (
alphago
_Log, 1); GO -- Reset the database recovery model. ALTER DATABASE
alphago
SET RECOVERY FULL; GO
Tuesday, 29 November 2016
Oracle database size in MB/GB query with creation date.
col "Database Size" format a20
col "Free space" format a20
col "Used space" format a20
select round(sum(used.bytes) / 1024 / 1024 / 1024,2 ) || ' GB' "Database Size"
, round(sum(used.bytes) / 1024 / 1024 / 1024 ) -
round(free.p / 1024 / 1024 / 1024,2) || ' GB' "Used space"
, round(free.p / 1024 / 1024 / 1024,2) || ' GB' "Free space"
from (select bytes
from v$datafile
union all
select bytes
from v$tempfile
union all
select bytes
from v$log) used
, (select sum(bytes) as p
from dba_free_space) free
group by free.p
select
a.owner,b.created, ROUND(sum(bytes)/1024/1024,2) as size_in_MB, ROUND(sum(bytes)/1024/1024/102
from
dba_segments a inner join dba_users b
on a.owner=b.username
group by
a.owner,b.created;
MYSQL database size in MB/GB query with creation date.
"Database Size (MB)",ROUND(SUM(data_length+
"Database Size (GB)" FROM information_schema.TABLES GROUP BY table_schema;
MSQL database size in MB/GB query with creation date.
ROUND(SUM(mf.size) * 8 / 1024, 0) Size_MBs
,(SUM(mf.size) * 8 / 1024) / 1024 AS Size_GBs
FROM sys.master_files mf
INNER JOIN sys.databases d ON d.database_id = mf.database_id
WHERE d.database_id > 4 -- Skip system databases
GROUP BY d.NAME,create_date
ORDER BY d.NAME
kill/remove a process running on particular port in Linux
option 1:
netstat -tulpn | grep 1100
It will show the list of processes with port number and process id
tcp 0 0 0.0.0.0:1100 0.0.0.0:* LISTEN 22746/Rserve.dbg
the number before /Rserve.dbg
is a process id. Now use kill command to kill the process
kill -9
22746
-9 implies the process will be killed forcefully.
option 2:
lsof -i:1100
;kill -9
22746
oneshot: kill -9 $(lsof -t -i:1100)
option 3:
# fuser
1100
/tcp
#
fuser -k
1100
/tcp (kill)
Wednesday, 23 November 2016
How to check mysql dsn entry in Linux box
isql -v mydsn myusername mypassword
[root@linuxmysql opt]# isql -v analyt_52 reuser resuer
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
Friday, 18 November 2016
Creating a New DB2 Database Using a SQL Script
To create a new DB2 database using a SQL script
- Create a user for the new database. For example, to create a user named
csuser
on Linux:useradd -d /home/csuser -m -p welcome1 csuser
- Log in with DB2 instance owner credentials. For example,
db2inst1
. - Create a file with the following DB2 commands. (For example, create
db.sql
and modify the database name, path, and user variables to match your installation):CREATE DATABASE <DBNAME> AUTOMATIC STORAGE YES ON '<DB2_HOME>/Databases/<DBNAME>' DBPATH ON '<DB2_HOME>/Databases/<DBNAME>' USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM PAGESIZE 32768; CONNECT TO <DBNAME>; GRANT DBADM,CREATETAB,BINDADD,CONNECT,CREATE_NOT_FENCED_ROUTINE,IMPLICIT_SCHEMA,LOAD,CREATE_EXTERNAL_ROUTINE,QUIESCE_CONNECT,SECADM ON DATABASE TO USER <DBUSER>; UPDATE DATABASE CONFIGURATION USING APPLHEAPSZ 1024 DEFERRED; UPDATE DATABASE CONFIGURATION USING LOCKTIMEOUT 30 DEFERRED; UPDATE DATABASE CONFIGURATION USING APP_CTL_HEAP_SZ 1024 DEFERRED; UPDATE DATABASE CONFIGURATION USING LOGFILSIZ 32768 DEFERRED; UPDATE DATABASE CONFIGURATION USING LOGSECOND 8 IMMEDIATE ; CONNECT RESET;
- Create the directory for your database.
mkdir -p <DB2_HOME>/Databases/<DBNAME>
- Execute the sql script. For example:
db2 -tvsf createdb.sql
Useful DB2 Commands
Command | Description |
db2cmd | Open DB2 Command line Tool |
db2cc | Open DB2 Control Centre |
db2start | Start Database Normaly |
db2stop | Stop Database Normaly |
db2stop force | Stop Database forcely |
db2 force application all | Close all applications that uses DB2 Database. |
db2level | Display DB2 version and fix pack level |
db6level | Display DB2 Client Version |
db2 terminate | Close the database connection |
db2_kill -all | Kill a hanged instance |
db2licm -l | View license information |
db2 connect to <db2sid> | Establish connection to an instance |
db2 list tablespaces show detail | Displays table space information |
db2 get dbm cfg | Display configuration parameter of database manager. |
db2 get db cfg for <db2 sid> | Display configuration parameter of an instance |
db2 update dbm cfg using <parameter_name> <new value> | Change value of a database manager configuration parameter. |
db2 update db cfg for <db2 sid> using <parameter_name> <new value> | Change value of a instance configuration parameter. |
db2 drop database <target db2sid> | Delete and instance |
db2 activate db <dbsid> | Activate Database |
db2 deactivate <dbsid> | Deactivate an active database |
db2 rollforward db <SID> to end of logs | Apply all pending logs |
db2 rollforward db <db2sid> query status | Display rollforward status |
db2 backup database <sid> to "disk:\location" | Take an offline backup to specified location |
db2 list utilities show detail | Display Database backup status |
db2 restore db <sid> from "disk:\path" replace history file | Restore database from a backup image |
DB2 license installation steps
To apply any of the DB2 Enterprise Server Edition, DB2 Advanced Enterprise Server Edition, DB2 Workgroup Server Edition, or DB2 Advanced Workgroup Server Edition licenses:
- Install the DB2 Version 10.5 – Workgroup, Enterprise, and Advanced Editions common image using the DB2 Setup wizard.
- Run the db2licm -a command, to apply the relevant licenses for either the DB2 Enterprise Server Edition, DB2 Advanced Enterprise Server Edition, DB2 Workgroup Server Edition, or DB2 Advanced Workgroup Server Edition.
Windows
db2install_path\bin\db2licm -a filename
where db2install_path is the DB2 installation path, filename is the full path name and file name for the license certificate file that corresponds to the DB2 product edition you have purchased.
Linux or UNIX
INSTHOME/sqllib/adm/db2licm -a filename
where INSTHOME represents the home directory of the instance owner and filename is the full path name and file name for the license certificate file that corresponds to the DB2 product edition you have purchased. The db2licm command can also be found in the path where the DB2 database product is installed. For example, /opt/IBM/db2/V10.5/adm on Linux or UNIX operating system, if you use the default installation directory.
- If you have purchased a DB2 add-on offering, run the db2licm -a command to activate the relevant functionalities for the DB2 offering. For example: if you purchased the IBM® DB2 BLU Acceleration In-Memory Offering:
Windows
db2install_path\bin\db2licm -a <license_path>/db2baf.lic
where db2install_path is the DB2 installation path, <license_path> is the full path name for the license file, and db2baf.lic is the license certificate file of IBM DB2 BLU Acceleration In-Memory Offering.
Linux or UNIX
INSTHOME/sqllib/adm/db2licm -a <license_path>/db2baf.lic
where INSTHOME represents the home directory of the instance owner and <license_path> is the full path name for the license file, and db2baf.lic is the license certificate file of IBM DB2 BLU Acceleration In-Memory Offering.
- To verify the DB2 product license information, run the db2licm -l command.
that key can’t be used to activate this edition of windows
Method 1:
This may work for other later Operating Systems but it has been tested on 2012 R2.
I installed 2012 R2 on a brand new server as a trial and then later the license arrived, while trying to install the license, it was failed with error saying "that key is not valid for this version of Windows".
Firstly, check to make sure of what version you are using by running the following command
dism /online /get-currentedition
and check the possible target edition
dism /online /get-targeteditions
and if yours is supported then all you need is the new key and run the following command, be sure you are connected to the internet.
dism /online /set-edition:EDITION /product xxxxx-xxxxx-xxxxx-xxxxx-xxxxx /accepteula
if you don't put /accepteula it will not work.
SCREEN SHOTS:
If you try and enter the new product key from the System Control Panel you'll receive an activation error like below.
Open an Administrative Command Prompt. Then run the command:
slmgr.vbs /dlv
Slmgr.vbs /dlv is used for volume licensing, and this step is to gather information only. The /dlv switch displays detailed license information. As you can see below we are currently running the ServerStandardEval edition.
If you wanted to continue using the trial for another 180 days, your could use the /rearm switch.
From the Administrative Command Prompt, run the command:
dism /online /get-currentedition
This will confirm the information we obtained from slmgr.vbs /dlv, as you can see the current version is ServerStandardEval.
Next, run the command:
dism /online /get-targeteditions
This will show you which versions the current evaluation license can be upgraded to, in our case it can be upgraded to ServerStandard or ServerDatacenter.
Next run the command:
dism /online /set-edition:ServerStandard /ProductKey:xxxxx-xxxxx-xxxxx-
This command selects the version of Windows 2012 R2 you want to upgrade to, specifies the product key and Accepts the Eula.
Once the process has completed it will prompt you to restart your computer.
The process will reboot the server twice.
Once completed and logged in you can see in the bottom right hand corner that the server is no longer running and evaluation version. Also on my test server I received an Shutdown Event Tracker.
Wednesday, 16 November 2016
SQL Developer is returning only the date,not the time
Monday, 14 November 2016
"Unable to connect to RDP server" message using Remmina in Ubuntu 12.04
WiFi/LAN Network icon disappeared in Windows tasks bar.
- Click Start
- Type: regedt32
- Press enter
- Using the left pane, navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network - Once in the above folder, right-click on Config and choose Delete
- Close Registry Editor
- Reboot.
Tuesday, 8 November 2016
Linux Oracle Database Installation : Display Problem
Here, some steps to solve the display problem
1. open terminal as root
2. DISPLAY=:0.0
3. export DISPLAY
4. xhost +
5. su - oracle
6. DISPLAY=:0.0
7. export DISPLAY
8. execute ./runInstaller
if ./runInstaller still can't be executed, reboot server, and xhost + again
Sunday, 6 November 2016
how to Extend windows server evaluation grace period
Windows License is expired Build 9600
In this case, you only have two options:
- Purchasing a new Windows Key, activate windows through "Go to PC Settings".
- Extend Window Server evaluation period has expired .
Note : The windows will notify you with the following message.
Your Windows license will expire soon.
Before 12 days of Windows Server 2012 license Expiration to activate Windows.
In this hint, I will elaborate How to Extend Windows Server Evaluation Period by following the bit mentioned steps below:
Steps:
- Open Command Prompt as Administrator.
- Reset the licensing status of machine by typing the following command
- "
slmgr.vbs /rearm
".
- "
- Restart the server.
- The Windows Evaluation Period should now be extended to additional 180 days.
- After Server restart , wait a moment and you will find the license has been extended successfully.
Regarding Windows Server 2008
- Follow the above-mentioned steps with the following changes.
- The command will be
slmgr.vbs -rearm
instead ofslmgr.vbs /rearm
. - The command will extend windows evaluation period to additional 60 days, that can be used again for three times.
- The command will be