Search This Blog

Saturday, August 28, 2021

MSSQL: Decrease/Reduce the size of sql server log file

 

USE Your_Database_Name;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE Your_Database_Name
SET RECOVERY SIMPLE; GO DBCC SHRINKFILE (Your_Database_Name_Log, 1); -- Will resize log file to 1 MB.
GO ALTER DATABASE Your_Database_Name -- Reset the database recovery model.
SET RECOVERY FULL; GO

Friday, August 6, 2021

MSSQL: The log scan number (85:368:1) passed to log scan in database 'model' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during start up.

 


 First: Go to this path C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Binn\Templates


Second: Copy and paste the database/file named model.mdf and modellog.ldf to this path C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA



Now, problem will be resolved !

Tuesday, March 23, 2021

Oracle : ORA-00020: maximum number of processes (150) exceeded

 

ORA-00020: maximum number of processes (150) exceeded


To resolve this error , please follow below steps:

$ sqlplus -prelim "/as sysdba"

   SQL> Conn sys as sysdba

 SQL> shutdown abort

 ORACLE instance shut down.

 SQL> exit

 Disconnected from ORACLE

After this point the database could once again be restarted:

sqlplus / as sysdba


Then run below commands:


sql> alter system set processes=500 scope=spfile;

sql> alter system set sessions=555 scope=spfile;

sql> alter system set transactions=610 scope=spfile;

sql> shutdown abort

sql> startup

Saturday, October 17, 2020

Create view in SQL server for Binary duplicate check : Sqlserver

 


create   view vw_duplicate_face as

Select Photo, COUNT(EmployeeCode) as aa,

  min (EmployeeCode) AS EmployeeCode_min ,

  max (EmployeeCode) AS EmployeeCode_max

  from 

(

select [EmployeeCode], 

                     cast(cast([HDCPInfo] as varbinary(max)) 

                      as varchar(max)) 

  as Photo

from   [HWATT].[dbo].[KQZ_Employee]

)a

Group By Photo

Having COUNT(EmployeeCode)>1

Wednesday, September 9, 2020

Oraclre 12C: Pluggable Database (PDB) Automatic Startup

Below trigger will be created after SYS login to Container database



CREATE OR REPLACE TRIGGER auto_open_pdb

  AFTER STARTUP ON DATABASE 

BEGIN 

   EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN'; 

END auto_open_pdb

Saturday, December 14, 2019

ORACLE: UDE-00010: multiple job modes requested, schema and tables.


 Here , When you use below import command,

impdp userid=schema/pass@db statistics=none full=N schemas=(schema_name)  tables=TEST_TABLEdirectory=TEST_DIR dumpfile=SCHEMA_BACKUP.DMP logfile=SCHEMA_BACKUP.log

You will be shown error as 

UDE-00010: multiple job modes requested, schema and tables.

Solution with Example: Use only one parameter like SCHEMAS or TABLES.

When Parameter file are like ..

SCHEMAS=schema_name
DIRECTORY=TEST_DIR
DUMPFILE=SCHEMA_BACKUP.dmp
LOGFILE=SCHEMA_BACKUP.log
TABLES=TEST_TABLE1,TEST_TABLE2


So, full command will be like 

impdp userid=schema/pass@db statistics=none full=N   tables=TEST_TABLEdirectory=TEST_DIR dumpfile=SCHEMA_BACKUP.DMP logfile=SCHEMA_BACKUP.log