9/25/2019 Multiple Tnsnames Ora Filespeedy
I am adding two entries to the tnsnames,ora file on linux server. First there are two tnsnames.ora file: /u01/app/oracle/product/11.1.0/clien t1/networ k/admin/tn snames.ora /u01/app/oracle/product/11.2.0/netwo rk/admin/t nsnames.or a how I determine which one to use? Another thing is when I open the file for editing with vi editor, then i hit 'i' and get a warning: - INSERT - W10: Warning: Changing a readonly file than I add new entries and try to save it using:w, I get a warning 'E45: 'readonly' option is set (add! To override) ' So I try:w! To save it and get 'tnsnames.ora' E212: Can't open file for writing' Can someone tell me how do I make changes to tnsnames.ora? I am a UNIX user and my UNIX skill don't seem to apply to Linux.
This might be because since multiple tnsnames.ora file is created, the file used is not the one in which the db service is added. Can I now which tnsnames.ora file is being used & can I restrict to use a specific tnsnames.ora file.
Parsing out tnsnames.ora file contents. That’s a great script, and it comes so very close to meeting my needs. However, I have a few entries that have duplicate ADDRESS= references.
Our Oracle DBA states that this is accepted and is used as some degree of load balancing? Anyway, any tnsnames entry having more than 1 ADDRESS= entry causes the script to fail with errors like “ConvertFrom-StringData: Data item ‘ADDRESS’ in line ‘ADDRESS=’ is already defined. At D: My Documents PowerShell Get-OraTnsAdminEntries.ps1:68 char:32 + $lineBreakup = ConvertFrom-StringData -StringData $line.Replace( ” I know that hash tables require unique keys; can I ask how you’d go about a workaround for this edge case? Thank you in advance, Steve. Sure, thanks!
Here is a snippet of our current tnsnames.ora file. Well, it’s closer but not yet correct.
For example, this tnsnames.ora entry: OFNDEV1= (DESCRIPTION= (ADDRESS=(PROTOCOL=TCP)(HOST=vdcdb01-mip)(PORT=1525)) (ADDRESS=(PROTOCOL=TCP)(HOST=vdcdb02-mip)(PORT=1525)) (CONNECTDATA=(SERVICENAME=ofndev.threed.someserversomewhere.com)) ) Yields this result: Name: OFNDEV1 SimpleName: OFNDEV1 Protocol: TCP Host: vdcdb02-mip Port: 1525 Service: ofndev.threed.someserversomewhere.com Note that the final result contains only the last entry, not both entries. Also, a couple of errors are thrown: ConvertFrom-StringData: Data item ‘SERVER’ in line ‘SERVER=dedicated’ is already defined. At line:80 char:16 + $lineBreakup = ConvertFrom-StringData -StringData $line.Replace(“;”,”`n”) + + CategoryInfo: InvalidOperation: (:) ConvertFrom-StringData, PSInvalidOperationException + FullyQualifiedErrorId: InvalidOperation,Microsoft.PowerShell.Commands.ConvertFromStringDataCommand ConvertFrom-StringData: Data item ‘SERVER’ in line ‘SERVER=dedicated’ is already defined. At line:80 char:16 + $lineBreakup = ConvertFrom-StringData -StringData $line.Replace(“;”,”`n”) + + CategoryInfo: InvalidOperation: (:) ConvertFrom-StringData, PSInvalidOperationException + FullyQualifiedErrorId: InvalidOperation,Microsoft.PowerShell.Commands.ConvertFromStringDataCommand. Hi there, I’m searching for a way to parse tnsnames.ora into string like: Name, hostname/ip, port, servicename.
![]()
Name, hostname/ip, port, servicename. Name, hostname/ip, port, servicename. Name, hostname/ip, port, servicename.
Name, hostname/ip, port, servicename. Where standard (mostly but not perfectly) looks like: ” MYBASE= (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=10.20.30.40) (PORT=1234) ) (CONNECTDATA= (SERVER=dedicated) (SERVICENAME=MYSERVICE) ) ) ” And I need to do: MYBASE1 10.20. MYSERVICE MYBASE2 10.20. MYSERVICE MYBASE3 10.20. MYSERVICE MYBASE4 10.20. MYSERVICE Sorry for “just asking” but I have totally no idea how to parse in powershell but looks like most of the job is allready done and I have a bit problem with it Regards!
Hi.I am not sure where you are having a problem. 1) Open “PowerShell ISE” 2) Create a new file, paste and save the PowerShell function in this post as a.ps1 file. 3) Hit F5 to load the function into memory. 4) Save the TNS entries to a file (if it is not already in tnsnames.ora) 5) In the command portion of the ISE, call the function passing in the tns entries file name. PS C: Get-OraTnsAdminEntries -File “C: Tmp Sample.txt” ft Name SimpleName Protocol Host Port Protocol2 Host2 Port2 Service —- ———- ——– —- —- ——— —– —– ——- MYBASE MYBASE TCP 10.20. MYSERVICE If you want to export to a csv, you could do this PS C: Get-OraTnsAdminEntries -File “C: Tmp Sample.txt” Export-Csv -LiteralPath C: tmp TNSAsCSV.csv I was able to run your sample TNS entry and produce the above output.
I am not sure about the problem you are facing since you did not provide any details.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |