Using SQL Plus. Now you've seen me use a tool SQL Plus quite a lot and I've connected like this. What this is actually doing, is it's connected directly to the database on the Linux Server. I can't go onto my client machine and talk to the database like this because, well, I actually typed that wrong. Control C and it's not going to respond. Sysdba hit return, it doesn't know what to talk to, it should give me an error. TNS Protocol Adapter Error, it's trying to use a thing called TNS in the client software and it can't find it because it just, it just isn't there. So we'll show you what that means, this connects directly. If I go into my TNS Directory on my server, I have a file, remember we ran Net Manager and we created this and I told you how TNS links up to the Listener. What happens is this TNS thing is a network name called SI that I can use on my server at the moment and I can talk through this protocol, through this network layer piece of software called Transparent Network Substrate, I can talk to the Listener. So what I do is, I connect to the database, let's say as the system user at SI. I login as that and what's happening is that Oracle or the SQL Plus program is sending the Listener a request for a connection using SI and if we come back up here again look at the TNS File. It says SI connection string and now we look at the Listener File and the Listener is listening on this same connection string, protocol host name and it listens for connections. As soon as it gets a connection request it takes the connection request from the user as in me doing this, System at SI and passes that connection to a process. A Server Process running on the database and then the Server Process continues to service that connection once it's connected, allowing other people to come along and connect to that Listener again because it's now freed. Because the Listener has done it's task of listening for a connection passing it off to a Server Process. So that's the basics of connecting to SQL Plus and if I want to connect on my local machine, I actually have to go and run a similar program that I ran on the server and I've got to find it first. It's called Net Manager, Net Manager, Netmgr, I'm going to run this on my Windows box and I'm going to use it to create a TNS File on my Windows box. I could literally go into my client installation on my Windows machine, find the directory, the Network Admin Directory which I'll show you in a minute. Oh, hang on a second, what am I running here? It looks like I've actually already created this connection on there. We create the same way and I'm wondering why it didn't actually work. Hang on a second. Okay, I am going to go into the directory on here. So my Oracle software for 11.2 is installed here, it's installed under a name called laptop because my initial name was laptop and I changed it and Client. Again similar directory to that on the Linux box, Network Admin inside the Oracle Client Directory. Yes I already have this file here, TNS Names, let's have a look at it, let's make sure it's correct. Because, alright so let's go back out of here. I did have a problem, there's a program called TNS Ping which allows you do a ping through the TNS Substrate and it's actually running. System at SI, okay it's actually working, I thought it wasn't for some strange reason. Okay that's SQL Plus, again I can do Select count from DBA Tables and now connected from my Windows XP machine to my database, I'm getting the same data. It's going across the network and within the Oracle installation for 11g, there is a tool here called SQL Plus which is really just a Command Window. Now I'm not too keen on this thing because it does something completely weird, in other words it doesn't work because it doesn't allow you to put the TNS Connection in. Now it may allow you to actually change the link in Windows generally and put the TNS Connection String in there somehow. But I don't see how you would do that, doesn't make sense. What I like to do actually is I like to install the 10g Client because it gives you access to a tool that's no longer available in 11g. It looks like this with this little window thing here, SQL Plus which is a little bit easier to use than the Command Line version. Apart from that it actually allows you to login using the TNS thing and yet again and asking me, it's asking for my Firewall permission to go through there. And Select Count Star. Okay I got to highlight the window first, it's Windows. DBA Tables, right okay. I made a mistake there, but it's a pretty obvious mistake, I'm just typing too fast, I left out the From Clause. You'll learn all about Select and From Clauses later on. Again, the same data, that's SQL Plus. It's a tool that you can use, there is all sorts of formatting you can use with it which we will get into as we go through the course but there is another tool in Oracle that we'll go through in the next movie that you can use for SQL Coding as well. And I'm just going to get all the stuff off the screen so we know where we're at.
| Course: | Introduction to Oracle 11g |
| Author: | Gavin Powell |
| SKU: | 34312 |
| ISBN: | 978-1-61866-042-8 |
| Release Date: | 2012-04-28 |
| Duration: | 11.5 hrs / 139 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |