Toad for Oracle Base Edition (64-bit)
25.2.386.6575
Could the TNS Names Editor have an option to save the entries sorted alphabetically? We have about 50 instances, and new instances come on board or deprecated instances get closed down. Different teams and members can have a subset of them, too. It’s hard to track changes or differences across teams because the order in TNSNames.ora files aren’t deterministic, which it would be if alphabetically sorted.
That's not a bad idea. I'll add it to the list. I think it would also be nice if the comparison were smarter - just find the missing/different entries, regardless of position.
One thing you could do now is change the formatting style to "single line", then format the file, then find some other app to sort it (comments would get misplaces at this point but I guess that's OK for this purpose), then make whatever changes you want and finally change the format back to however you want it.
I could write something to do it myself, a small app, but the TNS Names Editor already seems to parse TNS names files and the tree is already alphabetical on display, so it appears to me at least, that it has done most of the “heavy lifting” for such functionality. I assumed the tree nodes hold the TNS entry data it has parsed, so thought it would be pretty simple to just write that back to a file in the tree order? Perhaps I’m mistaken there?
Yeah it wouldn't be hard to sort. I was just talking about it with Pavel, one of our other developers. I think the tricky part would be knowing what to do with comments that may be in the file.
Usually my comments in tnsnames pertain to the entry immediately after them. But sometimes they pertain to a group. that could get lost in sorting.
One of the things I have already added for next version is the ability to filter the list.
Funnily enough, I was just thinking that I hadn’t mentioned comments and was considering what you’d do with them.
I’m the same as you, my comments precede the TNS entry, but I take the point that these might not be how everyone does them, although I do think it’s the most obvious solution to the comment issue.
Have you considered using IFILE for the instances that are shared across your org or teams? Have one person responsible for maintaining the master list and post it on a network accessible share or send the updated file out to team members. That way all shared resources are kept up to date and local tnsnames.ora files reference the common file and can optionally specify additional entries that are not shared.
@mstaszew That is certainly a good idea and is probably the correct approach, but there’s a lot of people in my organisation and rolling out such a change is never quick. Also, some people are deliberately only given a subset of TNS entries (in various combos, just as an extra layer of access prevention) and that might prove to be the sticking point. So in the meantime, sorting would be a nice to have.
I know you guys are busy, so I just knocked up a little application for sorting, leaving any preceding comments with the next TNS entry, so in the meantime, I have a workaround at least. It’s not as pretty or clever as your UI though, and I do think sorting would be useful on the TNS Names Editor, caveated with comments sticking with next TNS entry. I prefer sorted TNS Names files, as it’s easier to find and slot in new entries, but I usually have to do it by hand, which is cumbersome.
As for the compare logic you suggested, yes, I think it’s a good idea, but would it be a lot of work for you, especially if not many people use it, and you still have the comments’ issue….