Solved

SPFILE  -  URGENT!!!!!  -  Big Mistake

Posted on 2004-08-31
29
722 Views
Last Modified: 2008-03-06
I opened the PFILE in wordpad to look at it.  Then being a newbie to Oracle and not following the directions I made a change to it and saved it (OOPS!!!).

Anyway, now I can't connect with SQLPlus, or even get into the Enterprise Manager in Oracle 10g.

Is there a way to replace this file with a "default" one?  I am really lost and need some help fast!  I think I will read the directions a little more carefully next time.

I am running the 10g suite of tools and made a change to the file because I was trying to install the repository.  The file still has the parameters in it.  But it looks like something was messed up since I changed it with Wordpad.

Any help or if you can point me in the right direction would be greatly appreciated
0
Comment
Question by:Intern
  • 12
  • 12
  • 2
  • +2
29 Comments
 
LVL 23

Expert Comment

by:seazodiac
Comment Utility
@intern:

can you post any error message when you try to log in with sqlplus?

Is the datasbase server machine on the Windows or UNIX?
0
 
LVL 10

Expert Comment

by:SDutta
Comment Utility
It seems you have modified the SPFILE not the PFILE. The PFILE is a text file that can be edited and is used only on database startup, whereas the SPFILE is a binary file and should not be edited manually.

If you have a recent PFILE you can recreate the spfile from it.
SQL> create spfile from pfile='initSID.ora';

Otherwise, you can look into the alert.log file and locate the statement "System parameters with non-default values:". Copy and paste the parameters into a text file and name it like the PFILE. Then startup the database with this file and recreate the SPFILE with the "create spfile" statement as above.
0
 
LVL 1

Author Comment

by:Intern
Comment Utility
I have all the parameters in the current SPFILE - but the formating must have gotten damagd, since I edited using Wordpad.  Anyway - how can I use this command:

SQL> create spfile from pfile='initSID.ora';

If I can't log into SQL??

The error in SQLPlus is - TNS could not resolve the service name.  The whole database does not seem to be working.  

0
 
LVL 23

Expert Comment

by:seazodiac
Comment Utility
I think  this SQLPLUS error has NOTHING to do with the fact that you modified that file.

ok, Intern, can you clarify what the file you have modified , preferrable, the filename?

and where is your database server, where do you try to connect using sqlplus , are they on the same machine?
0
 
LVL 1

Author Comment

by:Intern
Comment Utility
This is the file

*.background_dump_dest='C:\oracle\product\10.1.0\admin\orcl\bdump'
*.compatible='10.1.0.2.0'
*.control_files='C:\oracle\product\10.1.0\oradata\orcl\control01.ctl','C:\oracle\product\10.1.0\oradata\orcl\control02.ctl','C:\oracle\product\10.1.0\oradata\orcl\control03.ctl'
*.core_dump_dest='C:\oracle\product\10.1.0\admin\orcl\cdump'
*.db_block_size=8192
*.db_cache_size=25165824
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='orcl'
*.db_recovery_file_dest='C:\oracle\product\10.1.0\flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.java_pool_size=50331648
*.job_queue_processes=10
*.large_pool_size=8388608
*.open_cursors=3000
*.pga_aggregate_target=25165824
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.shared_pool_size=83886080
*.sort_area_size=262144
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='C:\oracle\product\10.1.0\admin\orcl\udump'
0
 
LVL 23

Expert Comment

by:seazodiac
Comment Utility
can you post up the TNSNAMES.ORA file and SQLNET.ORA file in your $ORACLE_HOME/network/admin folder?
0
 
LVL 23

Expert Comment

by:seazodiac
Comment Utility
Ok, intern, now this file is PFILE , NOT SPFILE.

so I am quite positive that this SQLPLUS error has NOTHING to do with the fact that you modified that file.
 


Plus, if you are in 10g, most likely you DON'T use this PFILE anymore, you are using SPFILE instead....


so there are something else, please answer all my questions in my above POSTS...
0
 
LVL 1

Author Comment

by:Intern
Comment Utility
Edited file - SPFILEORCL.ORA

Database server is sitting next to me (it is a test server), I tried to connect using SQLPLUS in both my machine and also from the box that the Database is on.  
0
 
LVL 1

Author Comment

by:Intern
Comment Utility
I also changed the INIT.ORA file - the only thing that I changed in this file is a couple of settings that were supposed to be changed to install the Repository on this machine.

TNSNAMES.ORA -
ORCL.CORP.CSBN.COM =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = theoracle.corp.csbn.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
    )
  )

SQLNET.ORA -
NAMES.DEFAULT_DOMAIN = corp.csbn.com
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (LDAP, TNSNAMES, ONAMES, HOSTNAME)
DEFAULT_SDU_SIZE = 8761

Changes made to INIT.ORA
sort_area_size = 262144
shared_pool_size = 32000000
open_cursors = 3000
processes = 100
0
 
LVL 10

Expert Comment

by:SDutta
Comment Utility
If you are sure your database is really down (check the alert.log file), you can start it up like this :

SQLPLUS /NOLOG
SQL> CONNECT SYS AS SYSDBA
-- Use the initsid.ora text file you created with the parameters from alert.log or the battered SPFILE
SQL> STARTUP RESTRICT PFILE='C:\InitSID.ora';
SQL> create spfile from pfile='C:\InitSID.ora';
You should have a new SPFILE now, dont edit this directly.
SQL> SHUTDOWN IMMEDIATE;
-- now use the SPFILE to startup the database
SQL> STARTUP;
0
 
LVL 23

Accepted Solution

by:
seazodiac earned 450 total points
Comment Utility
sorry, then you are modifying SPFILEORCL.ORA..


ok,  try to follow this steps:

1. go to control-panels --->services ---> change the OracleServiceORCL properties to make it manually start , not automatically start.

2. shutdown the computer (the server machine).

3. Once the machine is up, open a DOS window.

4. at the command prompt:

C:\>set ORACLE_HOME=C:\oracle\product\10.1.0
C:\>set ORACLE_SID=orcl
C:\>sqlplus "sys/****** as sysdba"

you will see a message "connect to an idle instance" ,
and in this folder 'C:\oracle\product\10.1.0\admin\orcl\pfile' , there is a file called "init.ora.xxxxxxxxxxxxxxx", rename it for convenience  to just init.ora
SQL> create spfile='C:\oracle\product\10.1.0\SPFILEORCL.ORA' from pfile='C:\oracle\product\10.1.0\admin\orcl\pfile\init.ora';

SQL>startup



that should do it....
0
 
LVL 1

Author Comment

by:Intern
Comment Utility
>>CONNECT SYS AS SYSDBA

After this command it asks me for a password, once I enter the password it will give me the following error -

TNS: protocol adapter error
0
 
LVL 1

Author Comment

by:Intern
Comment Utility
I am trying that now - It may be a little later when I get back to you.  I have a business lunch to go to.  Thank you for all your help so far
0
 
LVL 23

Expert Comment

by:seazodiac
Comment Utility
You have to RESTART the database since you cannot get into it with sqlplus or EM.

just follow my last post to restart the machine ....
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 34

Expert Comment

by:Mark Geerlings
Comment Utility
Editting the pfile definitely *CAN NOT* prevent you from connecting to Oracle (unless you then shut down the database, and it fails to restart).  Similarly, editting the SPFILE will not prevent you from logging in (again, unless you then shut down the database and it fails to restart it when you try to restart it).

You should never edit your SPFILE.  You may edit you PFILE if you are careful, and if you want to do things that aren't supported in an SPFILE (like removing optional parameters) but this will have no affect on a running Oracle database, and will only affect the database after you shut it down and intentionally start it from a PFILE instead of the SPFILE.

What error do you get in SQL*Plus when you try to connect?
0
 
LVL 1

Author Comment

by:Intern
Comment Utility
>>You should never edit your SPFILE.  You may edit you PFILE if you are careful, and if you want to do things that aren't supported in an SPFILE (like removing optional parameters) but this will have no affect on a running Oracle database, and will only affect the database after you shut it down and intentionally start it from a PFILE instead of the SPFILE.


As you can see from my initial post - I realize that I am a moron - or at least on a steep learning curve
0
 
LVL 23

Expert Comment

by:seazodiac
Comment Utility
Just elaborate more on the STEP 4 in my post:

if this command : "SQL> create spfile='C:\oracle\product\10.1.0\SPFILEORCL.ORA' from pfile='C:\oracle\product\10.1.0\admin\orcl\pfile\init.ora';"

fails, this is because you have a file by the same name already. you need to rename that existing file or delete it before you run this command again.
0
 
LVL 1

Author Comment

by:Intern
Comment Utility
>>sqlplus "sys/password1 as sysdba"

When I issue this command I get nothing.  It waits a little bit and then it will go back to the command prompt.  I can open sqlplus in the graphical interface - but it is not opening from the command prompt.
0
 
LVL 23

Expert Comment

by:seazodiac
Comment Utility
you can do that in SQLPLUS graphic interface too...

so do it there...let's know what happens...

but there is something fishy with command prompt sqlplus

can you try this and post the results?

C:\>sqlplus /nolog

0
 
LVL 23

Expert Comment

by:seazodiac
Comment Utility
or use the single quote around...


C:\>sqlplus 'sys/password1 as sysdba'


0
 
LVL 1

Author Comment

by:Intern
Comment Utility
nothing - with both suggestions

I am really confused now, even if I use "sqlplus" and nothing else.  Could this be something with the set ORACLE_HOME command.  Would this affect sqlplus if something was wrong in that command??
0
 
LVL 1

Author Comment

by:Intern
Comment Utility
I changed the set ORACLE_HOME to

set ORACLE_HOME=C:\oracle\product\10.1.0\db_1

c:\>sqlplus "sys/password1 as sysdba"
Message 133 not found; product=SQLPlus; facility=SP2
: Release 9.0.1.4.0 - Production on etc...

ERROR:
ORA-12538: TNS:no such Protocol adapter

Enter user-name:

This is what I get now
0
 
LVL 23

Expert Comment

by:seazodiac
Comment Utility
was you able to use SQLPLUS before?

this is correct: set ORACLE_HOME=C:\oracle\product\10.1.0\db_1


try to modify your SQLNET.ORA file

change this line:
NAMES.DIRECTORY_PATH= (LDAP, TNSNAMES, ONAMES, HOSTNAME)

to

NAMES.DIRECTORY_PATH= (TNSNAMES, LDAP, ONAMES, HOSTNAME)
0
 
LVL 23

Expert Comment

by:seazodiac
Comment Utility
than save sqlnet.ora file, try sqlplus again...
0
 
LVL 23

Expert Comment

by:seazodiac
Comment Utility
are you getting anywhere with my latest suggestion?
0
 
LVL 9

Expert Comment

by:konektor
Comment Utility
create pfile, or as i see you already have it
shutdown DB (or it id down and u cannot start it ...)
sql> startup pfile=<filepath to pfile>
create spfile from pfile after database has started
0
 
LVL 1

Author Comment

by:Intern
Comment Utility
>seazodiac

I am still having trouble getting into SQLPlus, so I am not sure what to do.  Our company just purchaced Oracle DB, Developer and a bunch of other stuff but the paperwork has not gone through yet so I have no access to support yet.  Our salesrep from Oracle said that he will try to get someone on the phone with me and fix the problem.  I will keep trying your suggestions until that happens though.  Anyway thanks for your help so far.
0
 
LVL 9

Assisted Solution

by:konektor
konektor earned 50 total points
Comment Utility
i didn't mentioned u cannot log to sqlplus ...

ORA-12538: TNS:no such Protocol adapter means, that sqlplus doesn't know which database should it connect to

at cmd prompt run :
c:>sqlplusw /nolog
SQL> conn sys@<sid of your DB> as sysdba

if u obtain error ORA-12541, your listener does not run. try to start it (c:> lsnrctl start).
if u cannot start listener u can do this :
c:>set ORACLE_SID=<sid of your DB>
c:>sqlplusw /nolog
SQL> conn sys as sysdba -- see no specifying database name (it's taken from OS environment variable)
0
 
LVL 1

Author Comment

by:Intern
Comment Utility
>seazodiac

THANK YOU!!!!!  The problem is finally fixed - your solution worked great.  Please post a message at the following link so I can give you the rest of the points:

http://www.experts-exchange.com/Databases/Oracle/Q_21114037.html
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now