locked
file changes in CMD RRS feed

  • Question

  • 0

    Hi Everyone,

    I am going to be a pain and ask you all another question,

    I am setting up a zero touch install after massive problems with the Oracle sid eof things these are now fixed due to massive help by all the guys in the scripting forum but we have another issue,

    some of the files need changing in multiple folders e.g C:\oracle\server\net80\admin\INIT.ora (these are just edited in notepad) to fit our software for example;

    ######################

    ######JAVA POOL#########

    ######################

    Pool:5641148455

    Cache:65464545318

    Size:643214842

    This is just an example we have about 40 of these to do but have time to set about setting it up we need this to be

    ######################

    ######JAVA POOL#########

    ######################

    Pool:999999999

    Cache:999999999

    Size:999999999

    how would we go around changing this is CMD prompt or making a script to do it

    Any help at all i will be extremely gratefull

    Cheers Guys,

    Gavin



    • Edited by Gavin Doris Tuesday, April 23, 2013 3:50 PM
    Monday, April 22, 2013 1:08 PM

Answers

  • okay the tnsnmes was an example forget about that i will give you another example

    Text file.txt

    Hi I'm Gavin

    i want to replace Gavin With James so it looks like

    Text file.txt

    Hi I'm James

    Thats what i need to do

    Open the file and read it into a variable .  Use Replace on the variable to replace the name then save the file.

    newtext=Replace(oldtext,"Gavin","James")

    Now write 'newtext' back to the file.

    That is all you need to replace one word in a  file.

    It is very easy in PowerShell:

    (Get-Content 'test file.txt' ).Replace('Gavin','James') | Out-File 'test file.txt'

    But I don't think that is what you want to do and I do not think it will be of any help because you fail to understand how text processing works and how the config files are structured.  If you do not have uniqueness then this method will fail.


    ¯\_(ツ)_/¯

    • Marked as answer by Gavin Doris Tuesday, April 23, 2013 12:04 PM
    Tuesday, April 23, 2013 8:36 AM
  • Now play nice.

    The issue is partly that there is no well defined request.  The request is very open ended.  You need to do a lot of something to a lot of files for a lot of customers.  That is not exactly a rigorous technical request.

    You now have three suggestions for editing a simple word in a file.  That is probably as good as you will get.

    I know you have an idea that you want to have a large file of edits and have them automatically applied.  This can be done but you will have to write it.  No one is going to do it for you.  You can do this but I suspect you don't care to learn how to write a script.  So far you have produced no lines of scrip showing that you are trying to do this.

    Why?

    Start a script.  Post it will a question.  Learn one bit at a time but you must write a script.


    ¯\_(ツ)_/¯

    • Marked as answer by Gavin Doris Tuesday, April 23, 2013 10:41 AM
    Tuesday, April 23, 2013 10:39 AM

All replies

  • Try this command:

    for /F "delims=" %a in ('dir /s /b c:\Oracle ^| find /i "TSNames.ora"') do @echo copy /y c:\TSNames.ora "%a"

    You must, of course, create the default file (shown in bold) "c:\TSNames.ora". Replace "@echo copy" with "@copy" to activate the command.

    • Marked as answer by Gavin Doris Monday, April 22, 2013 2:33 PM
    • Unmarked as answer by Gavin Doris Monday, April 22, 2013 2:45 PM
    Monday, April 22, 2013 2:11 PM
  • Try this command:

    for /F "delims=" %a in ('dir /s /b c:\Oracle ^| find /i "TSNames.ora"') do @echo copy /y c:\TSNames.ora "%a"

    You must, of course, create the default file (shown in bold) "c:\TSNames.ora". Replace "@echo copy" with "@copy" to activate the command.

    Will you explain this a bit more to me please?
    Monday, April 22, 2013 2:26 PM
  • Do the following:

    1. Open a command prompt window

    2. Type the following command and press Enter:

    for /?

    Read the screens of information for how cmd.exe's for /f command works.

    Bill

    • Marked as answer by Gavin Doris Monday, April 22, 2013 2:33 PM
    • Unmarked as answer by Gavin Doris Monday, April 22, 2013 2:45 PM
    Monday, April 22, 2013 2:29 PM
  • Do the following:

    1. Open a command prompt window

    2. Type the following command and press Enter:

    for /?

    Read the screens of information for how cmd.exe's for /f command works.

    Bill

    Bill,

    Just a quick question will you give me an example of how i would do what i need to do above i am looking at for /? now and i cant see one that will copy and replace items within a file

    Gavin

    Monday, April 22, 2013 2:39 PM
  • Will you explain this a bit more to me please?

    Which part of the command is unclear?
    Monday, April 22, 2013 2:39 PM
  • Will you explain this a bit more to me please?

    Which part of the command is unclear?
    i dont see how the command is going to copy and replace text or numbers within the file could you give me a full example please?
    Monday, April 22, 2013 2:44 PM
  • i dont see how the command is going to copy and replace text or numbers within the file could you give me a full example please?

    In your initial post you stated that you have a default file TSNames.org - the one that looks like this:

    ######################
    ######JAVA POOL#########
    ######################
    Pool:999999999
    Cache:999999999
    Size:999999999

    The command I gave you will do this:

    • The "dir ... | find" command will locate each instance of TSNames.org, no matter where it resides in the folder C:\Oracle.
    • The command copy /y c:\TSNames.ora "%a" will copy the default .ora file over every instance of TSNames.ora.
    • While the word "echo" is present, the command will only show you what it would do. It won't do any copying yet.

    Monday, April 22, 2013 3:10 PM
  • With Oracle you can set up a TNSNAMES server on one Oracle instance.  After this you can just alter the Oracle client install to point at the TNSNAMES server.  FRom that point on all name definitions are handled by the server.

    Contact Oracle forums for learning how to install and manage Oracle.  You do not need to use scripting for this.  YOU need to learn how to manage Oracle and all becomes very easy.  The way you are doing this is a very old way to do it.


    ¯\_(ツ)_/¯

    Monday, April 22, 2013 3:17 PM
  • as i have stated a few times tnsnames was an example there is over 40 file changes that need to be done not all of them oracle and most of them we have to change oracle default settings i have spoken to oracle and they have said there is no way of changing that and as you know on posts you have commented on before there is a lot more than just file changes being done including reg entries of variables so every install is different hense needing to know commands so instead of taking 8 hours for an install we can set it running and get on with the day
    Monday, April 22, 2013 3:33 PM
  • as i have stated a few times tnsnames was an example there is over 40 file changes that need to be done not all of them oracle and most of them we have to change oracle default settings i have spoken to oracle and they have said there is no way of changing that and as you know on posts you have commented on before there is a lot more than just file changes being done including reg entries of variables so every install is different hense needing to know commands so instead of taking 8 hours for an install we can set it running and get on with the day

    That is a really long, difficult to read, and difficult to understand run-on sentence. For best help, please use correct punctuation and form coherent sentences so that others can read and understand what you are asking.

    Bill

    Monday, April 22, 2013 3:40 PM
  • With Oracle you can set up a TNSNAMES server on one Oracle instance.  After this you can just alter the Oracle client install to point at the TNSNAMES server.  FRom that point on all name definitions are handled by the server.

    Contact Oracle forums for learning how to install and manage Oracle.  You do not need to use scripting for this.  YOU need to learn how to manage Oracle and all becomes very easy.  The way you are doing this is a very old way to do it.


    ¯\_(ツ)_/¯

    If you read the initial post then you will see there are over 40 file changes not all oracle,

    so speaking to them is going to do nothing this is the newest way of doing it as our software isn't compatible with the new versions of oracle and windows,

    i don't need to know what lessons i need to take and there is no need to have separate instance for TNSNAMES. 

    Monday, April 22, 2013 3:46 PM
  • Are you asking if there is a simple batch technique to replace strings in a text file?

    Doing so is fairly straightforward if you're familiar with a scripting language. Cmd.exe shell script (batch file) is usually not the simplest way.

    Aside from all this is whether or not this is needed. I'm not an Oracle DBA or admin, but it seems peculiar to me that a software that advanced would require so many changes to config files on client machines. jrv's post seems to indicate there are better ways to manage Oracle software configurations than by individually editing client files on hundreds of machines. I agree and would be surprised if this was not the case.

    Bill

    Monday, April 22, 2013 4:01 PM
  • With Oracle you can set up a TNSNAMES server on one Oracle instance.  After this you can just alter the Oracle client install to point at the TNSNAMES server.  FRom that point on all name definitions are handled by the server.

    Contact Oracle forums for learning how to install and manage Oracle.  You do not need to use scripting for this.  YOU need to learn how to manage Oracle and all becomes very easy.  The way you are doing this is a very old way to do it.


    ¯\_(ツ)_/¯

    If you read the initial post then you will see there are over 40 file changes not all oracle,

    so speaking to them is going to do nothing this is the newest way of doing it as our software isn't compatible with the new versions of oracle and windows,

    i don't need to know what lessons i need to take and there is no need to have separate instance for TNSNAMES. 

    What you are asking is very vague and confusing which might account for the mismatch between your question and our answers:

    What does this question mean?  What are you trying to say?

    You posted this: "how would we go around changing this is CMD prompt or making a script to do it"

    It doesn't make any sense to me. What is menat by CMD prompt in this context?

    You originally asked for assistance with TNSNAMES here:

    "some of the files need changing in multiple folders e.g C:\oracle\server\net80\admin\TNSNAMES.ora (these are just edited in notepad) to fit our software for example;"

    I also do not really understand what that sentence is intended to say/ask.

    I assume you want to set up your TNSNAMES.ORA files.  This can be done in many ways.  In old times I used TNSNAMES.ORA and set up a central version of this file with all se5rvers in the organization and all databases in the organization in the central file.  We would then just copy this out to the workstations on a restart to ensure that the latest version was always installed.  We also set up all Workstations to use one single TNSNAMES file stored in a central location.  You can set an environment variable to point to this and it will be the master names file.

    I prefer using an Oracle TNSNAMES server as it only requires setting an environment variable to enable it.

    Now if you are just asking how to remotely 'edit' arbitrary text files then you will need to write a script to do this.  The contents of that script would be determined entirely by what edits you need to make; this sounds like it would be very complicated in your environment.  You would need to spend some time writing and testing this.  Look in the repository for examples.  If you do not want to learn how to write script then you will need to hire a consultant to do this task for you.

    As for your last statement:

    If you read the initial post then you will see there are over 40 file changes not all oracle,

    so speaking to them is going to do nothing this is the newest way of doing it as our software isn't compatible with the new versions of oracle and windows,

    i don't need to know what lessons i need to take and there is no need to have separate instance for TNSNAMES. 

    #1 We cannot see the 40 file changes required so that is of no help in understanding what you are asking.
    #2 The suggested method is not new to Oracle or Windows but has been available for all Oracle for almost 20 years.  It has nothing to do with the applications  All versions of the Oracle client that will run in Windows can use this method for connecting the Oracle Network Client. (ORANET)
    #3  I did not say you need separate instance for TNSNAMES.  TNSNAMES is a mapping between arbitrary names and Oracle databases and servers.  A TNSNAMES server replaces the TNSNAMES.ORA file with a central names server which provides TNSNAMES.ORA functionality from a central location.  This is how Oracle is designed to be used in a large mixed platform environment.  Image if organizations with hundreds of databases had to update all TNSNAMES.ORA files every time there was a change.  This would be unmanageable. M recommendation for learning how to do a layered and staged deployment of teh Oracle client would save you hundreds of hours of headaches.  There is no need to invent a homegrown solution.  Oracle has already solved that problem for you.

    If you still insist on scripting a solution then start with a PowerShell of VBScript that can find all of the files you need to edit.  Once you can enumerate the files you can create the custom coed needed to do the changes.  There is no automatic way to do this.  You will have to design and write this script yourself or hire a consultant.  You can post back with specific questions when you get stuck.

    If I am still misunderstanding what you are asking then please try to find a way to ask your question that is more direct.  Perhaps reducing the problem to a set of manual steps that you take to do this now would be more informative.


    ¯\_(ツ)_/¯





    • Edited by jrv Monday, April 22, 2013 4:31 PM
    Monday, April 22, 2013 4:24 PM
  • okay can i make it this simple i need to edit text files on a big scale is there an easy way to do that and save it so i can run something that just changed the text files sorry for this being so confusing

    Gavin

    Tuesday, April 23, 2013 7:57 AM
  • okay can i make it this simple i need to edit text files on a big scale is there an easy way to do that and save it so i can run something that just changed the text files sorry for this being so confusing

    Gavin

    sorry just realized that wasn't clear i need to edit files on a big scale for a lot of customers so i want to type all the file changes once and then run something to do it on different machines to stop me having to type it everytime

    Gavin

    Tuesday, April 23, 2013 8:02 AM
  • okay can i make it this simple i need to edit text files on a big scale is there an easy way to do that and save it so i can run something that just changed the text files sorry for this being so confusing

    Gavin

    Again - no.  You must write a script to do the edits.  Of course the exact steps are not being posted so anything any of us might say is pure guesswork.

    There is no tool that can guess at what you want to do.  You have to either write down all of the steps and get them converted to a tool or write  a script that opens, searches, changes, saves an closes each file.

    The problem here is that  you are trying to do something in a way that was never intended.  By setting up the Oracle client correctly none of this is necessary.  The same is true of the Java bits.

    I still do not understand what you are asking.  You posted that you want to edit TNSNAME.ORa then you posted a lot of odds and ends of JAVA settings which are not part of TNSNAMES.  I think you are missing some bits of how allf this actually works.

    Here is an aryicle on how to edit the ORA config files on all systems (Windows, Unix, Mac, etc):

    http://docs.oracle.com/cd/A57673_01/DOC/net/doc/NWUS233/apb.htm

    TO automatically edit this we can create a script that understands the syntax rules and loads config into a structure.  THe structure can be easily edited from a specification file then the structure can be exported back into a file.  This script does not exists.  It must be written.

    The Oracle Net API has methods to edit these files which can also be used to edit them.  A script or program can be written to do this.  It might be done in PowerShell.

    Here is an example of a VBScript that adds entries to tnsnames:

    http://www.itninja.com/question/checking-if-entries-exist-in-tnsnames-ora-via-vbscript


    ¯\_(ツ)_/¯

    Tuesday, April 23, 2013 8:17 AM
  • okay the tnsnmes was an example forget about that i will give you another example

    Text file.txt

    Hi I'm Gavin

    i want to replace Gavin With James so it looks like

    Text file.txt

    Hi I'm James

    Thats what i need to do

    Tuesday, April 23, 2013 8:22 AM
  • okay the tnsnmes was an example forget about that i will give you another example

    Text file.txt

    Hi I'm Gavin

    i want to replace Gavin With James so it looks like

    Text file.txt

    Hi I'm James

    Thats what i need to do

    Open the file and read it into a variable .  Use Replace on the variable to replace the name then save the file.

    newtext=Replace(oldtext,"Gavin","James")

    Now write 'newtext' back to the file.

    That is all you need to replace one word in a  file.

    It is very easy in PowerShell:

    (Get-Content 'test file.txt' ).Replace('Gavin','James') | Out-File 'test file.txt'

    But I don't think that is what you want to do and I do not think it will be of any help because you fail to understand how text processing works and how the config files are structured.  If you do not have uniqueness then this method will fail.


    ¯\_(ツ)_/¯

    • Marked as answer by Gavin Doris Tuesday, April 23, 2013 12:04 PM
    Tuesday, April 23, 2013 8:36 AM
  • If you prefer a vbsscript.Copy below lines into a text file with extension .vbs.

    I call it ReplaceRegExp.vbs

    Then use it inside a for /r loop at the command prompt.

    ReplaceRegExp.vbs Filename RegExpFindStr ReplaceStr

    "C:\Users\David Candy\Documents\Assorted\Scripts\ReplaceReg
    Exp.vbs" "xtest.txt" "g" "x"

    Replaces g with x in the file xtext.txt

    Omitting the ReplaceStr turns it into a find utility. You'll probably want to edit it a bit to get rid of the message boxes.

    On Error Resume Next
    Set ShellApp = CreateObject("Shell.Application")
    ReportErrors "Creating Shell.App"
    set WshShell = WScript.CreateObject("WScript.Shell")
    ReportErrors "Creating Wscript.Shell"
    Set objArgs = WScript.Arguments
    ReportErrors "Creating Wscript.Arg"
    Set regEx = New RegExp
    ReportErrors "Creating RegEx"
    Set fso = CreateObject("Scripting.FileSystemObject")
    ReportErrors "Creating FSO"
    WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Wscript.ScriptName & "\", Chr(34) & Wscript.ScriptFullName & Chr(34)
    WshShell.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Left(Wscript.ScriptName, Len(Wscript.ScriptName)-3) & "exe" & "\", Chr(34) & Wscript.ScriptFullName & Chr(34)
    ReportErrors "Updating App Paths"
    If objArgs.Count = 0 then
      MsgBox "No parameters", 16, "Serenity's ReplaceRegExp"
      ReportErrors "Help"
    ElseIf objArgs.Count = 1 then
      MsgBox "Only one parameter", 16, "Serenity's ReplaceRegExp"
      ReportErrors "Help"
    ElseIf objArgs.Count = 2 then
      Set srcfile = fso.GetFile(objArgs(0))
      ReportErrors "srcFile"
      If err.number = 0 then Set TS = srcFile.OpenAsTextStream(1, 0)
      If err.number <> 0 then
       Msgbox err.description & " " & srcFile.path, 48, "Serenity's Search"
       err.clear
      else
       ReportErrors "TS" & "     " & srcFile.path
       Src=ts.readall
       If err.number = 62 then
        err.clear
       else
        ReportErrors "ReadTS" & "     " & srcFile.path
        regEx.Pattern = objArgs(1)
        regEx.IgnoreCase = True
        regEx.Global = True
        If regEx.Test(Src) = True then
         Msgbox "Found in " & srcfile.path, 64, "Serenity's Search"
        End If
       End If
      End If
      ReportErrors "Check OK" & "     " & srcFile.path
    Elseif objArgs.count = 3 then
      Set srcfile = fso.GetFile(objArgs(0))
      ReportErrors "srcFile"
      If err.number = 0 then Set TS = srcFile.OpenAsTextStream(1, 0)
      If err.number <> 0 then
       Msgbox err.description & " " & srcFile.path, 48, "Serenity's Search"
       err.clear
      else
       ReportErrors "TS" & "     " & srcFile.path
       Src=ts.readall
       If err.number = 62 then
        err.clear
       else
        ReportErrors "ReadTS" & "     " & srcFile.path
        regEx.Pattern = objArgs(1)
        regEx.IgnoreCase = True
        regEx.Global = True
        NewSrc= regEx.Replace(Src, objArgs(2))
        If NewSrc<>Src then
         Msgbox "Replacement made in " & srcfile.path, 64, "Serenity's Search"
         TS.close
         Set TS = srcFile.OpenAsTextStream(2, 0)
         ts.write newsrc
         ReportErrors "Writing file"
        End If
       End If
      End If
      ReportErrors "Check OK" & "     " & srcFile.path
    Else
      MsgBox "Too many parameters", 16, "Serenity's ReplaceRegExp"
      ReportErrors "Help"
    ReportErrors "All Others"
    End If
    Sub ReportErrors(strModuleName)
     If err.number<>0 then Msgbox "An unexpected error occurred. This dialog provides details on the error." & vbCRLF & vbCRLF & "Error Details " & vbCRLF & vbCRLF & "Script Name" & vbTab & Wscript.ScriptFullName & vbCRLF & "Module" & vbtab & vbTab & strModuleName & vbCRLF & "Error Number" & vbTab & err.number & vbCRLF & "Description" & vbTab & err.description, vbCritical + vbOKOnly, "Something unexpected"
     Err.clear
    End Sub


    David Candy

    Tuesday, April 23, 2013 9:18 AM
  • okay can i make it this simple i need to edit text files on a big scale is there an easy way to do that and save it so i can run something that just changed the text files sorry for this being so confusing

    Gavin

    sorry just realized that wasn't clear i need to edit files on a big scale for a lot of customers so i want to type all the file changes once and then run something to do it on different machines to stop me having to type it everytime

    Gavin

    I would nominate you for the following three prizes of the month:

    • Creating the vaguest and most confusing post.
    • Writing the longest run-on sentences.
    • Having the most misleading post Subject line.

    I think you will easily win all three prizes.

    Tuesday, April 23, 2013 10:17 AM
  • okay can i make it this simple i need to edit text files on a big scale is there an easy way to do that and save it so i can run something that just changed the text files sorry for this being so confusing

    Gavin

    sorry just realized that wasn't clear i need to edit files on a big scale for a lot of customers so i want to type all the file changes once and then run something to do it on different machines to stop me having to type it everytime

    Gavin

    I would nominate you for the following three prizes of the month:

    • Creating the vaguest and most confusing post.
    • Writing the longest run-on sentences.
    • Having the most misleading post Subject line.

    I think you will easily win all three prizes.

    do these prizes consist of an answer or just more sarcasm?
    Tuesday, April 23, 2013 10:31 AM
  • Now play nice.

    The issue is partly that there is no well defined request.  The request is very open ended.  You need to do a lot of something to a lot of files for a lot of customers.  That is not exactly a rigorous technical request.

    You now have three suggestions for editing a simple word in a file.  That is probably as good as you will get.

    I know you have an idea that you want to have a large file of edits and have them automatically applied.  This can be done but you will have to write it.  No one is going to do it for you.  You can do this but I suspect you don't care to learn how to write a script.  So far you have produced no lines of scrip showing that you are trying to do this.

    Why?

    Start a script.  Post it will a question.  Learn one bit at a time but you must write a script.


    ¯\_(ツ)_/¯

    • Marked as answer by Gavin Doris Tuesday, April 23, 2013 10:41 AM
    Tuesday, April 23, 2013 10:39 AM
  • Thanks JRV,

    I will have a look into writing a script for it though it is not the area i work in in the slightest

    Thanks to everyone for there help and a massive thank you to Oberwald for believing in me to win 3 prestigious awards

    Kind Regards,

    Gavin

    Tuesday, April 23, 2013 10:51 AM
  • okay the tnsnmes was an example forget about that i will give you another example

    Text file.txt

    Hi I'm Gavin

    i want to replace Gavin With James so it looks like

    Text file.txt

    Hi I'm James

    Thats what i need to do

    Open the file and read it into a variable .  Use Replace on the variable to replace the name then save the file.

    newtext=Replace(oldtext,"Gavin","James")

    Now write 'newtext' back to the file.

    That is all you need to replace one word in a  file.

    It is very easy in PowerShell:

    (Get-Content 'test file.txt' ).Replace('Gavin','James') | Out-File 'test file.txt'

    But I don't think that is what you want to do and I do not think it will be of any help because you fail to understand how text processing works and how the config files are structured.  If you do not have uniqueness then this method will fail.


    ¯\_(ツ)_/¯

    just to let you know the powershell script works when you change the files to a txt format so i found a script that changes the files to txt then back to there original extension running them all at once works absolutely fine so i have sorted the issue and just need to do it for all of them thanks for all your help
    • Marked as answer by Gavin Doris Tuesday, April 23, 2013 12:04 PM
    • Unmarked as answer by Gavin Doris Tuesday, April 23, 2013 12:04 PM
    Tuesday, April 23, 2013 12:03 PM
  • I would nominate you for the following three prizes of the month:

    • Creating the vaguest and most confusing post.
    • Writing the longest run-on sentences.
    • Having the most misleading post Subject line.

    I think you will easily win all three prizes.

    do these prizes consist of an answer or just more sarcasm?
    Sarcasm is as far from my mind as clear thinking is from yours. I honestly believe that you deserve these prizes.
    Tuesday, April 23, 2013 12:43 PM
  • okay the tnsnmes was an example forget about that i will give you another example

    Text file.txt

    Hi I'm Gavin

    i want to replace Gavin With James so it looks like

    Text file.txt

    Hi I'm James

    Thats what i need to do

    just to let you know the powershell script works when you change the files to a txt format so i found a script that changes the files to txt then back to there original extension running them all at once works absolutely fine so i have sorted the issue and just need to do it for all of them thanks for all your help

    Changing the extension of a file does not change its type. I can tell you are technically totally lost. You really need to learn the very fundamental things about computers and files. Things would be much easier if you knew the basics like what a file is.

    Note that a file does not really have a format.  A report has a format and a disk can be formatted.  A file is of type text when its contents contain printable characters and can usually be edited by notepad.  The file will be all ascii or Unicade characters.  The file name or extension has nothing to do with this except that some files have a TXT extension.

    TNSNAMES.ORA is a text file and can be edited as such without changing its name.

    (Get-Content tnsnames.ora ).Replace('server1.dom.net','server2.dom.net') | Out-File tnsnames.ors

    This works just fine but, as I posted, is unreliable if the text you want to change is not constant.  Text typed by humans is not constant.

    By the way. Word and Excel files, although printable, are not text files. They are proprietary binary files.

    XML file are text files.  INI files are text files. CSV files are text files.


    ¯\_(ツ)_/¯

    Tuesday, April 23, 2013 1:31 PM
  • I would nominate you for the following three prizes of the month:

    • Creating the vaguest and most confusing post.
    • Writing the longest run-on sentences.
    • Having the most misleading post Subject line.

    I think you will easily win all three prizes.

    do these prizes consist of an answer or just more sarcasm?

    Sarcasm is as far from my mind as clear thinking is from yours. I honestly believe that you deserve these prizes.

    So I was watching a 'Bones' episode where Temperance gives the CDC guy a compliment.  He replies, "you are just being sarcastic". She retorts, "Why thank you for noticing."

    ¯\_(ツ)_/¯

    Tuesday, April 23, 2013 1:36 PM
  • okay the tnsnmes was an example forget about that i will give you another example

    Text file.txt

    Hi I'm Gavin

    i want to replace Gavin With James so it looks like

    Text file.txt

    Hi I'm James

    Thats what i need to do

    just to let you know the powershell script works when you change the files to a txt format so i found a script that changes the files to txt then back to there original extension running them all at once works absolutely fine so i have sorted the issue and just need to do it for all of them thanks for all your help

    Changing the extension of a file does not change its type. I can tell you are technically totally lost. You really need to learn the very fundamental things about computers and files. Things would be much easier if you knew the basics like what a file is.

    Note that a file does not really have a format.  A report has a format and a disk can be formatted.  A file is of type text when its contents contain printable characters and can usually be edited by notepad.  The file will be all ascii or Unicade characters.  The file name or extension has nothing to do with this except that some files have a TXT extension.

    TNSNAMES.ORA is a text file and can be edited as such without changing its name.

    (Get-Content tnsnames.ora ).Replace('server1.dom.net','server2.dom.net') | Out-File tnsnames.ors

    This works just fine but, as I posted, is unreliable if the text you want to change is not constant.  Text typed by humans is not constant.

    By the way. Word and Excel files, although printable, are not text files. They are proprietary binary files.

    XML file are text files.  INI files are text files. CSV files are text files.


    ¯\_(ツ)_/¯

    That's exactly what i am doing but there was a .CONF file that i tested with and it worked fine and you covered all the file types that need editing above.

    i am running on a virtual machine so no damage can be caused i am just trying my options and seeing what is the best solution

    Tuesday, April 23, 2013 1:40 PM
  • As I posted earlier, the extension has nothing to do with anything.  It is just a name. 

    I think you do not understand the point I am making because you do not know enough about computer systems.  This also says that my original issue still stands.  If you learn how to do deployments of Oracle clients and things like Java you will find that you do not need to do this.  Unfortunately you do not know enough of the basics to even understand what I am trying to show you.  I have been installing Oracle applications since the first Oracle on VAX (30 years).  I know how this works.  If you actually learn how these things work you will see that the setups can be done much more easily.

    Good luck with building a better editor.


    ¯\_(ツ)_/¯

    Tuesday, April 23, 2013 2:04 PM
  • Hi Gavin Doris,

    A big part of the problem seems to be language. I don't know if English is your first language but your sentences are not written in a readable way and don't follow normal English grammar, so what you are writing is almost always nearly impossible to understand. I think it speaks well of the group participants that some of us were able to "hang in there" and at least try to make sense out of what you are asking. You may want to take some English writing courses so at least people can have a chance at understanding what you are writing.

    Bill

    Tuesday, April 23, 2013 2:14 PM
  • The client install is absolutely fine click of a button and its done we have already set that up, it is the server installs that are causing the issues we install using the 10g oracle universal installer for the app server & database then install the patch upgrades 7677781,8202632,8350262,5983622 and 9282569

    then all of the file changes are made to the oracle and pre generated keys,

    this would have probably been good information to give you to start off with, sorry

    Tuesday, April 23, 2013 2:19 PM
  • The client install is absolutely fine click of a button and its done we have already set that up, it is the server installs that are causing the issues we install using the 10g oracle universal installer for the app server & database then install the patch upgrades 7677781,8202632,8350262,5983622 and 9282569

    then all of the file changes are made to the oracle and pre generated keys,

    this would have probably been good information to give you to start off with, sorry

    It is clear now that you are just making all of this up.  Editing tnsnames has nothing to so with 10g installs.  You can stage a 10g install to install with all provided patches.  It does not require any editing of ora files.  An application can be installed on an Oracle instance without all of this nonsense.

    I think we are just letting you drag us around in circles.  If you write a script that shows what you need then someone will try and help you but, at this point, this is pointless.

    Sorry but...


    ¯\_(ツ)_/¯

    Tuesday, April 23, 2013 2:29 PM
  • Bill,

    I am trying to keep on top of hundreds of company's issues while typing this sorry for the bad grammar but i really don't have the time to be worrying about it, i need a fix for this issue due to it taking a whole day for me to do a server install and whole days is something i defiantly don't have.

    Sorry for that being an inconvinience to you

    Gavin

    Tuesday, April 23, 2013 2:31 PM
  • I am trying to keep on top of hundreds of company's issues while typing this sorry for the bad grammar but i really don't have the time to be worrying about it, i need a fix for this issue due to it taking a whole day for me to do a server install and whole days is something i defiantly don't have.

    Sorry for that being an inconvinience to you

    (?) It's even more of an inconvenience to yourself, because if nobody can understand what you are writing, then you delay the possibility for an answer even longer!

    I think at this point, since we have marked an answer, we need to drop this topic and move on.

    Bill

    Tuesday, April 23, 2013 2:40 PM
  • I think we are just letting you drag us around in circles.

    ¯\_(ツ)_/¯

    Troll?
    Tuesday, April 23, 2013 2:42 PM
  • i have literally just told you the steps i do to install the software, the tnsnames needs editing because when it is installed it looks like;

    # tnsnames.ora Network Configuration File: C:\Oracle\frhome_1\network\admin\tnsnames.ora
    # Generated by Oracle configuration tools.

    REP_SERVER IP_FRHOME1. =
      (ADDRESS = (PROTOCOL = tcp)(HOST = SERVER IP)(PORT = 1950))


    EXTPROC_CONNECTION_DATA =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = SERVER IP)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVICE_NAME = PLSExtProc)
        )
      )

    The server IP obviously needs to be the server IP that is why we need the program that makes the file changes,

    there are multiple files like this

    Gavin



    • Edited by Gavin Doris Tuesday, April 23, 2013 2:54 PM
    Tuesday, April 23, 2013 2:52 PM
  • We have several problems here:

    1. You keep changing the question. This is a frustrating game of "Is this what you're asking?" "No, that's not it." "What about this?" "Nope, that's not it either." "What about this?" "Nope, that isn't it either. Oh, and I forgot to tell this." [Another piece of information comes that completely changes the entire nature of the question.]

    2. As already noted, if you can't ask a clear question, nobody can help because nobody can understand what you're asking.

    3. This is not a scripts-on-demand forum. Sorry, but we don't have the resources to design custom solutions for forum posters' specific needs.

    If solving your problems (whatever they are) is critical to your organization, then I recommend finding a qualified consultant.

    Bill

    Tuesday, April 23, 2013 3:18 PM
  • 1.It is still exactly the same question as the start that has been answered now hence me marking it as an answer,

    2..The replies now are to JRV's comments about the installer i got given the script i needed i am not asking for someone to write me one it was for advice that i have been given,

    3.The question must have been clear enough seeing as i got a perfect answer,

    4.i forgot to tell you one piece of information that wasn't massively vital to the question in hand ,

    Is there anything else you want to pick up?

    Gavin

    Tuesday, April 23, 2013 3:24 PM
  • i have literally just told you the steps i do to install the software, the tnsnames needs editing because when it is installed it looks like;

    # tnsnames.ora Network Configuration File: C:\Oracle\frhome_1\network\admin\tnsnames.ora
    # Generated by Oracle configuration tools.

    REP_SERVER IP_FRHOME1. =
      (ADDRESS = (PROTOCOL = tcp)(HOST = SERVER IP)(PORT = 1950))


    EXTPROC_CONNECTION_DATA =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = SERVER IP)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVICE_NAME = PLSExtProc)
        )
      )

    The server IP obviously needs to be the server IP that is why we need the program that makes the file changes,

    there are multiple files like this

    Gavin



    I will post this just once more.

    The TNSNAMES file is buiolt once per organization and copied ot all sevres and all clients.  YOu can do that or set up a TNSNAMES server and jsut copy a TNSBA|NAMES file that points to teh TNSNAMES server.

    There is never a need to edit every copy diffrerntly.  Think of TNSNAMES as a DNS server.  It caontains all of the unique names of all Oracle servers in the network.  Once copied ot all servers and clients they can all see each other as long as the permossions on the Oracle are set and allow a user (client instance) to connect.

    This gets done one per organization.  If you need to update it then update the master copy and copy it to all systems.  Understanding TNSNAMES is critical.  If you do not understand how this works you should not be let anywhere near an Oracle installation.  I have spent too much time undoing disiasters caused by untrained techs trying to customize TNSNAMES, LISTENER and ORANET files the way you are trying to do it.  The Oracle design is and has alwyas been to copy a common file throughout the orgaization. 

    Don't believe me - read the documentation.


    ¯\_(ツ)_/¯

    Tuesday, April 23, 2013 3:30 PM
  • The fact that you got an answer is mainly due to jrv's (and others') persistence, and has nothing to do with the clarity of the question(s).

    With regards to the rest of your post: Sorry; again, I don't understand what you're saying.

    As previously noted: This question is marked as answered and is closed. No further replies are needed.

    Bill

    Tuesday, April 23, 2013 3:32 PM
  • i have literally just told you the steps i do to install the software, the tnsnames needs editing because when it is installed it looks like;

    # tnsnames.ora Network Configuration File: C:\Oracle\frhome_1\network\admin\tnsnames.ora
    # Generated by Oracle configuration tools.

    REP_SERVER IP_FRHOME1. =
      (ADDRESS = (PROTOCOL = tcp)(HOST = SERVER IP)(PORT = 1950))


    EXTPROC_CONNECTION_DATA =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = SERVER IP)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVICE_NAME = PLSExtProc)
        )
      )

    The server IP obviously needs to be the server IP that is why we need the program that makes the file changes,

    there are multiple files like this

    Gavin



    This file you have posted is the template for one entry set possible in TNSNAMES.  There will be more than one of these each pointing at a differnt server, instance or service on the corporate network.  Remember it is the DNS server for Oracle or - it is like the 'hosts' file on IWNdows and Unix and an Oracle TNSNAMES server is like a DNS server.  This is why it is called TNS - get it - DNS - TNS,


    ¯\_(ツ)_/¯

    Tuesday, April 23, 2013 3:33 PM
  • i know you are correct with this,

    all i am doing is inputting what i do on a day to day bases into a script/program to do it for me rather than manually

    and we have no centralization in that aspect we cant role it out to all instances as we deal with hundreds of company's all with different needs and setups

    Gavin

    Tuesday, April 23, 2013 3:37 PM
  • completely understand,

    but we cant have one specific one set because it has to be different everytime

    Tuesday, April 23, 2013 3:38 PM
  • This question is already marked as answered.

    No further replies, please, as nothing is getting any clearer.

    Bill

    • Marked as answer by Gavin Doris Tuesday, April 23, 2013 3:49 PM
    • Unmarked as answer by Gavin Doris Tuesday, April 23, 2013 3:49 PM
    Tuesday, April 23, 2013 3:47 PM
  • This file you have posted is the template for one entry set possible in TNSNAMES.  There will be more than one of these each pointing at a differnt server, instance or service on the corporate network.  Remember it is the DNS server for Oracle or - it is like the 'hosts' file on IWNdows and Unix and an Oracle TNSNAMES server is like a DNS server.  This is why it is called TNS - get it - DNS - TNS,


    ¯\_(ツ)_/¯

    Just to say

    I know you are trying to make me look stupid but you said how much experience you have before and as you can tell i don't,

    I am 17 and learning but i do need help so i look to people like yourselves who can help me and i am thankful to everyone in this post as it has helped but i am new to Oracle so trying to offend me with how much you know isn't going to work

    Thank you everyone no more replies needed

    Gavin

    Tuesday, April 23, 2013 3:48 PM