Search This Blog

Sunday, October 27, 2019

SQLSERVER : Passed to log scan in database 'model' is not valid



ERROR :  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.

I have done just to solve this:
Step-1: Go to this path C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Binn\Templates
Step-2: 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, service will be started !!! 

Monday, September 23, 2019

Wednesday, April 17, 2019

MSSQL: RESTORE DB USING master User



Alter Database <YOUR DB>
  SET SINGLE_USER With ROLLBACK IMMEDIATE
 
 
RESTORE DATABASE <YOUR DB>
  FROM DISK = 'D:\BACKUP_DB\FR_17.04.2019 morning'

Monday, April 1, 2019

Oracle : ORA-00600: internal error code, arguments: [kcratr_scan_lastbwr]



      SQL> startup mount
      SQL> alter database recover; //recover database;
      SQL> alter database open;

Tuesday, March 19, 2019

Comma separated value to ROWS in ORACLE SQL


SELECT t.id,
       v.COLUMN_VALUE AS value,
       ROW_NUMBER() OVER ( PARTITION BY id ORDER BY ROWNUM ) AS lvl
    FROM   prod_resource_mst t,
       TABLE(
         CAST(
           MULTISET(
             SELECT TRIM( REGEXP_SUBSTR( t.line_number, '[^,]+', 1, LEVEL ) )
             FROM   DUAL
             CONNECT BY LEVEL <= REGEXP_COUNT( t.line_number, '[^,]+' )
           )
           AS SYS.ODCIVARCHAR2LIST
         )
       ) v  where id=51

Monday, November 26, 2018

SQLSERVER: 'Concat' in SQL SERVER 2008

Example

Select a.* 
from testa a
Where (cast( a.column1 as varchar) +cast(a.column2 as varchar))    in (select  cast( b.column1 as varchar) +cast(b.column2 as varchar)  from testb b)


Sunday, June 3, 2018

Oracle Rows Generate from Column Value


Example

 Select COLUMN1,COLUMN2,
               From (
               select COLUMN1,COLUMN2,
                   regexp_substr(STRING_COLUMN,'[^,]+',1,column_value) as STR
                  from SAMPLE_TABLE
                        TABLE(cast(multiset(select level
                       from dual
                        connect by level <= length(DAYS) -
                                length(replace(DAYS,','))+1)
                               as sys.odcinumberlist))               
               )  Where ,COLUMN2=P_COLUMN2 and STR Is Not Null Order By 1,3