Friday, February 1, 2019

py0001 : could not find main class com/intellij/idea/main

Have you installed PyCharm on your system?
New to Python?

Probably there are chances of getting this error when trying to launch "JetBrains PyCharm Community Edition **** " from your desktop or from your start menu. I have search on google to reach out the solution every blog giving different solution related to Java_Home path, Java Version Issue ..etc..

But i simply uninstalled the application and installed as per below selection (see below screenshot)

While installation setup will ask for few Check boxes like 
  • 32-bit launcher
  • 64-bit launcher
  • Add lanchers dir to the PATH
  • Add "Open Folder as Project"
  • .py
  • Download and install JRE x64 by JetBrains

Earlier i have installed without "Download and install JRE x64 by JetBrains" selection so i was getting this error.

later i have uninstalled and re-install with all check-box selected with "32-bit launcher" and worked successfully.

Don't forgot to leave your comments if this is helpful.




Tuesday, January 22, 2019

dba_data_files data file not appears but dbf file in exists on FileSystem

Do NOT  Confuse

If you have executed command "DROP TABLESPACE *** INCLUDING CONTENTS AND DATAFILES;" on oracle database it would be noticeable that table-space and data-files has been deleted from server metadata i.e. no entry can be seen in dba_tablespaces and dba_data_files object.

But if you move to data-file physical path on your machine (in which oracle is installed) you may able to see old data-files (do not worry)!!.

Now you are thinking that i have deleted table-space why these files are here or you would try to delete this manually.

Is it safe to do? , can you delete this manually?

Yes you can delete this manually
1. Stop the server
2. Restart the Server
3. Delete unwanted datafiles from physical location

Error ORA-01144: File size (5242880 blocks) exceeds maximum of 4194303 blocks

While creating table-space you might get this error. This error generally comes up when you are giving large size to a data-file of table-space than allowed.
For creating large data-file table-space we need to create bigfile table-spaces.

But i would like to suggest not to create bigfile table-space for regular database restore create instead we can create simple table-space with multiple data-files.

Lets reproduce the issue, suppose i am trying to create table-space with data-file of size 40GB

CREATE TABLESPACE tablsapce1 DATAFILE 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\tablespace01_01.DBF' SIZE 40G AUTOEXTEND ON NEXT 40M;

Error will appear on the screen

Error ORA-01144: File size (5242880 blocks) exceeds maximum of 4194303 blocks

So it is better to create one table-space and add two data-files of 20Gb each, see below how to do it:

CREATE TABLESPACE tablsapce1 DATAFILE 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\tablespace01_01.DBF' SIZE 20G AUTOEXTEND ON NEXT 40M;

alter tablespace tablsapce1 add datafile 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\tablespace01_02.DBF' SIZE 20G AUTOEXTEND ON NEXT 10M;

In this way you can avoid this particular error

On Other hand the concept behind this is "db block size", it depends upon the your Oracle db block size that how bigger you can create your table-space/data-file.

For 2kb Block size data-file size should be below and equal to 8GB and for 4kb (16GB), 8kb (32GB ), 16kb (64GB), 32kb (128GB)

Thursday, August 9, 2018

Convert Semicolon Separated String in Rows Along With Respective Data

I have a situation, have a data in table with Primary key and one data field (assume it is a company) and third field contain the information of Person working in it in semicolon/comma separated format.




CREATE TABLE SemicolonSep
(
ID INT,
Company Nvarchar(20) ,
person VARCHAR(100)
)

INSERT SemicolonSep SELECT 1, 'A', 'Person1;Person2;Person3'
INSERT SemicolonSep SELECT 2, 'B', 'Person1'
INSERT SemicolonSep SELECT 3, 'C', ''
INSERT SemicolonSep SELECT 4, 'D', 'Person1;Person2;Person5;Person7'
INSERT SemicolonSep SELECT 5, 'E', 'Person1;Person2;Person5;Person7;Person15;Person17'

select * from SemicolonSep
;WITH temp(id, Company, NewData, person) AS
(
SELECT
id,
Company,
cast(LEFT(person, CHARINDEX(';', person + ';') - 1) as nvarchar),
STUFF(person, 1, CHARINDEX(';', person + ';'), '')
FROM SemicolonSep
UNION all

SELECT
id,
Company,
cast(LEFT(Person, CHARINDEX(';', Person + ';') - 1) as nvarchar),
STUFF(Person, 1, CHARINDEX(';', Person + ';'), '')
FROM temp
where Person > ''
)

SELECT
id,
Company,
NewData
FROM temp
ORDER BY id



Simple enough, You can use this output any where in further logic breakdowns as well as store output in any temp table or permanent table to use this data further.

Keywords:
  1. Convert semicolon separated string in rows
  2. Convert comma separated string in rows (just replace semicolumn with comma)
  3. Demoralize data
  4. Column to rows



Monday, February 19, 2018

SQL Server | DB Restore Error

When you are working on the task of database backup and restores, you might have error while restroe the database "database in use". This error populate because the current database is in use on same machine or over the network. There can be below cases:
1. On SQL Server database query window is open
2. Database query window will be open on any other computer in network
3. Database is currently connected with application

So in order to restore the database you need to disconnect the application from you machine or from another machine over the network.

Now, it is easy to disconnect the query window which is opened in your machine

Problem
It is difficult for you if any body using database over the network. Then how to disconnect all the connections

Solution

Sql Server 2012
DECLARE @query_v nvarchar(4000) = '';  
SELECT @query_v = @query_v + 'kill ' + CONVERT(varchar(10), session_id) + ';' FROM sys.dm_exec_sessions WHERE database_id  = db_id('Your_database_name')
EXEC(@query_v);


For SQL Server less than equal to 2008
DECLARE @query_v nvarchar(4000);
SELECT @query_v = @query_v + 'kill ' + CONVERT(varchar(10), spid) + ';' FROM master..sysprocesses WHERE dbid = db_id('Your_database_name')
EXEC(@query_v);

Note * - 
change the database name in above query, for which you want to restore the database
After change the database name you need to execute the above query


While query execution you can have below error

Msg 6104, Level 16, State 1, Line 1
Cannot use KILL to kill your own process.

Make sure while executing above query, close the current database query window or connect to "master" database

web stats