Tutorial 02 - Instalação da Base de Dados AdventureWorks Tutorial 02 - Installing the AdventureWorks Database
Neste segundo tutorial, vamos aprender a instalar e configurar a base de dados de exemplo fornecida pela Microsoft, para que possamos efectuar os próximos tutoriais. In this second tutorial, we will learn to install and configure the database as an example provided by Microsoft, so we can make the next tutorial.
Esta base de dados vem preenchida com dados de uma empresa fictícia de nome AdventureWorks. The database is populated with data from a fictitious company name of AdventureWorks.
Para podermos utilizar esta base de dados, necessitamos também de instalar e configurar o SQL Server 2005. To be able to use this database, we also need to install and configure the SQL Server 2005.
Este tutorial vai dividir-se me três secções distintas: This tutorial will break if I three distinct sections:
1. Instalação e configuração do SQL Server 2005 Express Edition Installation and configuration of SQL Server 2005 Express Edition
2. Instalação e configuração do SQL Server Management Studio Express Installation and configuration of SQL Server Management Studio Express
3. Instalação e configuração da base de dados de teste AdventureWorks. Installation and setup of the database of test AdventureWorks.
INSTALAÇÃO DO SQL SERVER 2005 EXPRESS EDITION Installation of SQL Server 2005 Express Edition
Para corrermos a base de dados necessitamos de ter o SQL Server 2005 instalado na nossa máquina. To run the database need to have SQL Server 2005 installed on our machine. Para efeitos de teste, temos disponível uma versão “free” o SQL SERVER 2005 EXPRESS EDITION. For testing purposes, we have a version available "free" SQL Server 2005 Express Edition.
Para efectuarmos o seu download navegamos até à página http://www.microsoft.com/sql/editions/express/default.mspx To make your download page to surf http://www.microsoft.com/sql/editions/express/default.mspx
Figura 1 – Página do SQL SERVER 2005 EXPRESS EDITION. Figure 1 - Page SQL Server 2005 Express Edition.
Nesta página temos um link do lado direito que nos leva para a página de download desta versão. On this page we have a link on the right side that leads us to the download page for this version.
Figura 2 – Página de download do SQL SERVER 2005 EXPRESS Figure 2 - Page to download the SQL Server 2005 Express
Na página de download deparamo-nos com dois pacotes distintos, um normal e outro com “Advanced Services”. In the download page we have two separate packages, one normal and another with "Advanced Services." No nosso caso serve-nos perfeitamente o pacote normal, pois não vamos usar “Reporting Services”, nem “Full-Text Search”. In our case serves us perfectly normal package, because we will not use "Reporting Services" or "Full-Text Search." Vamos no entanto utilizar o SQL Server Management Studio Express, que também podemos descarregar como um download único, como se pode ver na imagem seguinte: We will however use the SQL Server Management Studio Express, which also can download as a single download, as shown in the following image:
Figura 3 – Links de download Figure 3 - Links to download
Explicações à parte, resta-nos efectuar o download das aplicações. Explanations to the party, we download the applications. Como vamos precisar do SQL Server Management Studio Express mais à frente, podem aproveita e efectuar o seu download nesta fase. How we need the SQL Server Management Studio Express ahead, they can enjoy and make your download at this stage.
Após termos os ficheiros no nosso computador, vamos dar inicio à instalação propriamente dita do SQL Server 2005 Express Edition, executando o ficheiro correspondente. Having only the files on our computer, we will start the actual installation of SQL Server 2005 Express Edition, running the corresponding file.
No primeiro ecrã, só temos de aceitar a licença. On the first screen, we just have to accept the license.
Figura 4 - Primeiro Ecrã de instalação do SQL Server 2005 Express. Figure 4 - First Screen installation of SQL Server 2005 Express.
No segundo ecrã, o instalador mostra-nos alguns componentes que necessita de instalar, antes de dar inicio à instalação. In the second screen, the installer shows us that some components need to install, before beginning the installation. Podemos prosseguir normalmente, para que estes componentes requeridos sejam instalados. We can continue normally, so that required components are installed.
Figura 5 – Ecrã com os componentes requeridos que vão ser instalados. Figure 5 - Screen with the required components that will be installed.
Estes componentes são instalados rapidamente. These components are installed quickly. No vosso caso podem existir mais ou menos componentes que necessitem de ser instalados. In your case there may be more or less components that need to be installed.
Figura 6 – Instalação do SQL Server Express concluida. Figure 6 - Installation of SQL Server Express completed.
Depois dos pré-requisitos instalados, podemos iniciar a instalação do SQL Server Express, clicando no botão “Install”. After the prerequisites installed, we can start the installation of SQL Server Express by clicking on the "Install".
O instalador do SQL Server Express é finalmente lançado. The installer of SQL Server Express is finally launched.
Figura 7 – Instalador do SQL Server Express. Figure 7 - SQL Server Express Installer.
Ao clicarmos em “Next”, é efectuada uma pequena análise ao sistema para detectar possíveis problemas. By clicking "Next", a short analysis is made to the system to detect possible problems. No meu caso obtive um “warning”, mas nada de preocupante. In my case got a "warning", but nothing of concern.
Figura 8 – Resumo da análise ao sistema. Figure 8 - Summary of the analysis system.
Se tudo estiver correcto podemos prosseguir. If everything is correct we can continue.
No ecrã seguinte temos de introduzir as nossas informações para registo, sendo o campo “Company” opcional. On the next screen we have to introduce our information for registration, and the "Company" optional.
Figura 9 – Ecrã de Registo. Figure 9 - Screen Registry.
No próximo ecrã temos a opção de escolhermos quais os componentes so SQL Server Express que queremos instalar. In the next screen we have the option to choose which components SQL Server Express that want to install. No nosso caso vamos acrescentar os “Client Components” que não vêm seleccionados por omissão. In our case we will add the "Client Components" that are not selected by default. Para os adicionarmos clicamos com o botão esquerdo em cima do icone à esquerda do nome e escolhemos “This feature, and all subfeatures, will be installed on local hard drive”. To add the left-clicking the icon on top left of the name and choose "This feature, and all subfeatures, will be installed on local hard drive.
Figura 10 - Escolha dos componentes a serem instalados. Figure 10 - Choice of components to be installed.
No ecrã de autenticação alteramos o modo para Mixed Mode, permitindo-nos ter uma autenticação Windows ou SQL Server. The screen change the authentication mode to Mixed Mode, allowing us to have a Windows Authentication or SQL Server. Neste modo temos de introduzir uma password para o utilizador SQL “sa”. In this way we have to enter a password for the user SQL "sa". Introduzam a password que desejarem e memorizem-na. Enter the password you wish and memorize it.
Figura 11 – Modo de autenticação. Figure 11 - Mode authentication.
No ecrã seguinte, seleccionamos as duas opções, a primeira para permitir que utilizadores sem permissões de administrador possam correr uma instância do motor de SQL à parte, ea segunda para tornar o utilizador windows corrente num administrador do SQL Server. On the next screen, select the two options, the first to allow users without administrator permissions can run an instance of SQL engine apart, and the second to make the current windows user in a SQL Server administrator.
Figura 12 – Configurações de utilizadores e administração. Figure 12 - Configuration and administration of users.
O próximo ecrã permite-nos escolher se desejamos enviar informações de erro para a Microsoft. The next screen allows us to choose whether to send error information to Microsoft. Estas escolhas ficam ao vosso critério e não são relevantes para o funcionamento do SQL Server 2005 Express. These choices are at your discretion and are not relevant to the operation of SQL Server 2005 Express.
Figura 13 – Definições de envio de Possíveis erros. Figure 13 - Definitions of sending Possible errors.
Finalmente é-nos apresentado o ecrã com os componentes que vão ser instalados. Finally we are shown the screen with the components that will be installed. Ao clicarmos em “Install” é iniciada a instalção e configuração do SQL Server 2005 Express Edition. When you click "Install" starts the installation and configuration of SQL Server 2005 Express Edition.
Figura 14 – Lista de componentes que vão ser instalados. Figure 14 - List of components that will be installed.
Passado algum tempo, a instalação de todos os componentes é concluída. After some time, the installation of all components is completed.
Figura 15 - Lista de Componentes Instalados. Figure 15 - List of installed components.
Neste ponto temos o SQL Server Express finalmente instalado. At this point we have the SQL Server Express finally installed. Ainda existe um último ecrã com algumas informações úteis que nos indicam por exemplo que por questões de segurança alguns componentes são instalados de forma a ficarem desactivados, logo, se necessitarmos destes componentes temos de os activar manualmente. Although there is a final screen with some useful information that we show by example that for security reasons some components are installed in order to become disabled, so if we need these components to activate manually.
Figura 16 – Informações finais sobre a instalação. Figure 16 - Information on the final installation.
A primeira parte deste tutorial encontra-se concluída. The first part of this tutorial is completed. Neste momento já devemos ter o SQL Server 2005 Express Edition instalado nos nossos computadores. By now we should have SQL Server 2005 Express Edition installed on our computers.
Figura 17 – Menu do SQL Server 2005 acabado de Instalar. Figure 17 - Menu SQL Server 2005 Install finished.
Na parte seguinte vamos proceder à instalação da ferramenta SQL Server Management Studio Express, que nos permite efectuar uma gestão das bases de dados do SQL Server 2005. In the next part we will proceed with the installation of the tool SQL Server Management Studio Express, which allows a management of databases of SQL Server 2005.
INSTALAÇÃO DO SQL SERVER MANAGEMENT STUDIO EXPRESS Installation of SQL Server Management Studio Express
Se ainda não efectuaram download do ficheiro de instalação, então naveguem até à página: If you have not made the installation file to download, then navigate to the page:
https://www.microsoft.com/downloads/details.aspx?familyid=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&displaylang=en https: / / www.microsoft.com/downloads/details.aspx?familyid=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&displaylang=en
ou no site do SQL Server 2005 Express Edition em: or the site of SQL Server 2005 Express Edition at:
http://www.microsoft.com/sql/editions/express/default.mspx http://www.microsoft.com/sql/editions/express/default.mspx
Depois de termos o ficheiro de instalação no nosso computador, vamos executá-lo. After we have the installation file to our computer, we will run it.
Figura 18 – Ecra inicial de Instalação do SQL Server Management Studio. Figure 18 - Installation of the initial screen of SQL Server Management Studio.
No ecrã seguinte, aceitamos a licença. On the next screen, accept the license.
Figura 19 – Licença de Utilização do SSMS. Figure 19 - Use License of SSMS.
Introduzimos a nossa informação de registo (Campo “Company” é opcional). We introduced our information for registration (Field "Company" is optional.)
Figura 20 – Informações de Registo. Figure 20 - Registration Information.
O ecrã seguinte seria de escolha de componentes, mas como o SSMS apenas é constituído por um componente, podemos prosseguir com as definições que vêm por omissão, para dar inicio à instalação. The next screen is the choice of components, but only as SSMS is a component, we can continue with the default settings that come, to start the installation.
Figura 21 – Componentes do SSMS. Figure 21 - Components of SSMS.
A instalação do SQL Server Management Studio Express é relativamente rápida e ao fim de algum tempo temos o ecrã de instalação concluída. The installation of SQL Server Management Studio Express is relatively fast and after some time we have completed the installation screen.
Figura 22 – Instalação do SQL Server Management Studio Concluida. Figure 22 - Installation of SQL Server Management Studio Complete.
A instalação do SQL Server Management Studio Express também se econtra concluída. The installation of SQL Server Management Studio Express also econtra completed.
Neste momento temos o nosso computador pronto para receber qualquer base de dados, nomeadamente, a base de dados AdventureWorks. Today we have our computer ready to receive any database, including the database AdventureWorks.
Na parte seguinte do tutorial vamos instalar e configurar a base de dados. In the next part of the tutorial we will install and configure the database.
INSTALAÇÃO DA BASE DE DADOS DE TESTE ADVENTUREWORKS INSTALLATION OF THE DATABASE OF TEST ADVENTUREWORKS
Depois de já termos o SQL Server Studio 2005 a correr na nossa máquina, e de termos uma ferramenta para o administrar, podemos dar inicio à instalação da base de dados de teste AdventureWorks. After you already have the SQL Server Studio 2005 running on our machine and we have a tool to manage, we can begin the installation of the database of test AdventureWorks.
Esta base de dados pode ser encontrada no site dos Samples do SQL, alojado no Codeplex. The database can be found at the site of Samples SQL, housed in Codeplex.
http://codeplex.com/SqlServerSamples http://codeplex.com/SqlServerSamples
Nesta página vamos efectuar o download da última versão da Base de dados, na área releases. On this page we will download the latest version of the database in the area releases.
Figura 23 – Página de download da base de dados adventureworks. Figure 23 - page to download the database adventureworks.
Temos de ter cuidado para efectuar o download da versão correcta, pois no site já existe uma versão para o SQL Server 2008 CTP. We must be careful to download the correct version, because the site already exists a version for SQL Server 2008 CTP. Para efectuarmos o download da versão para SQL Server 2005 temos de mudar para essa área, através dos links laterais direitos. To download the version for SQL Server 2005 we have to change for this area, through the right side links.
Quando estivermos na área correcta, vamos efectuar download da versão mais simples da base de dados, que é a primeira da lista: When we are in the correct area, we will make downloading the simplest version of the database, which is the first in the list:
AdventureWorksDB.msi
Figura 24 – Lista de versões disponíveis. Figure 24 - List of versions available.
Após efectuarmos o download da base de dados, com aproximadamente 28 MB, vamos executar o ficheiro, que é um instalador. After download the database, with approximately 28 MB, we will execute the file, which is an installer.
Figura 25 - Instalador da base de dados de teste. Figure 25 - Installer database of the test.
Aceitamos a licença de utilização. We accept the license to use.
Figura 26 – Licença de utilização da Base de Dados. Figure 26 - License to use the Database.
Definimos a pasta de instalação, ea instalação é iniciada. Define the installation folder, and the installation starts.
Ao fim de algum tempo a instalação termina, indicando que a base de dados foi correctamente instalada. After a while the installation ends, indicating that the database was correctly installed.
Figura 27 – Finalização da Instalação da Base de Dados. Figure 27 - Completion of Installation of Database.
Nesta fase já temos a base dados instalada. At this stage we already have a database installed.
Para garantir que a mesma ficou correctamente instalada e configurada, vamos abrir o recém instaladao SQL Server Management Studio. To ensure it was properly installed and configured, we will open the newly instaladao SQL Server Management Studio.
Ao iniciar, precisamos introduzir as informações do servidor eo modo/credenciais de autenticação. At the start, we enter the information and how the server / authentication credentials.
Figura 28 - Definições de servidor e de autenticação Figure 28 - server settings and authentication
O nome do servidor deverá ser <NOME DO COMPUTADOR>\SQLEXPRESS. E o mode de autenticação pode ser Windows ou SQL Server, pois ao instalar o SQL Server escolhemos Mixed Mode. The server name should be <computer name> \ SQLEXPRESS. And the mode of authentication can be Windows or SQL Server, then install the SQL Server choose Mixed Mode. Se escolhermos Windows não necessitamos de introduzir as credenciais, no entanto, se escolhermos SQL Server Authentication, temos de introduzir o user “sa” ea password que criámos para o mesmo. If you choose Windows does not need to enter the credentials, however, if we choose SQL Server Authentication, we must enter the user "sa" and password that we created for it.
Ao entrármos no programa, temos à nossa disposição um explorador do lado esquerdo, onde podemos ver as bases de dados, e algumas propriedades associadas. To enter the program, we have at our disposal an explorer on the left, where you can see the databases, and some associated properties.
Aí necessitamos de associar a base de dados AdventureWorks ao Servidor SQL 2005, através do comando “Attach”. There need to link the database to AdventureWorks SQL Server 2005, through the command "Attach".
Figura 29 – Associar a base de dados ao servidor de SQL. Figure 29 - Linking the database to SQL server.
Na janela que aparece clicamos em “Add”. In the window that appears click on "Add."
Figura 30 – Ecrã de “Attach”. Figure 30 - Screen "Attach".
Depois escolhemos a base de dados correcta – AdventureWorks. Then choose the correct database - AdventureWorks.
Figura 31- Escolha da Base de Dados. Figure 31 - Select the Database.
Após termos escolhido a base de dados correcta, clicamos em ok e esta fica associada ao SQL Server 2005. After we chose the correct database, click OK and this is associated with the SQL Server 2005. Agora já podemos ver as suas tabelas através do SQL Server Management Studio. Now you can see their tables through SQL Server Management Studio.
Figura 32 – Tabelas da Base de dados. Figure 32 - Tables of Database.
Finalmente chegámos ao fim deste longo tutorial. Finally reached the end of this long tutorial. Espero que tenham conseguido completá-lo com sucesso. I hope we have managed to complete it successfully. Caso isso não tenha acontecido deixem um comentário. If it has not happened leave a comment.
No próximo tutorial vamos aprender a estabelecer a ligação à base de dados que acabámos de instalar. In the next tutorial we will learn to connect to the database that you just installed.
Se quiserem investigar um pouco sobre sql deixo-vos os links seguintes: If they want to investigate a little about sql let you the following links:
· Alguns tutoriais em video sobre SQL Server 2005 Some tutorials on video on SQL Server 2005
http://go.microsoft.com/fwlink/?LinkID=81768 http://go.microsoft.com/fwlink/?LinkID=81768
· Livro disponibilizado pela Microsoft sobre SQL Server 2005 Paper available on the Microsoft SQL Server 2005
http://go.microsoft.com/fwlink/?linkid=65208 http://go.microsoft.com/fwlink/?linkid=65208
NOTA: Este post já foi criado utilizando o Windows Live Writer. NOTE: This post has been created using Windows Live Writer. ![]()
Nuno Costa Nuno Costa
blog.istomesmo@gmail.com blog.istomesmo @ gmail.com
Deixem-me as vossas sugestões e comentários. Let me your suggestions and comments. ![]()
São muito bem vindos. Are very welcome.


Novembro 12th, 2007 at 14:25 November 12th, 2007 at 14:25
ae
cheguei na parte q fla de enttra pelo atach I arrived at the q fla of enttra by atach
ai fui la em add, mas nao tinha la o adventureworks_data.mdf I add it in there, but it was not the adventureworks_data.mdf
ai nao teve geito de eu termina there was not that I finish geito
pr favor mande a resposta o mais rapido possivel pr please send the answer as fast as possible
flw
Novembro 12th, 2007 at 23:15 November 12th, 2007 at 23:15
ola Felipe, quando vc faz o attach, é preciso ir procurar o ficheiro da base de dados, adventureworks_data.mdf na pasta do SQL Server (C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data). Hello Felipe, when you do the attach, you need to go find the file of the database, adventureworks_data.mdf SQL Server folder (C: \ Program Files \ Microsoft SQL Server \ MSSQL.1 \ MSSQL \ Data). Tenha o cuidado de verificar se na opção “Files of Type” está seleccionado “DataBase Files (*.mdf)”. Take care to check whether the option "Files of Type" is selected "DataBase Files (*. mdf).
Se mesmo assim não conseguir envie-me um email para blog.istomesmo@gmail.com que eu tento ajudar. If you still can not send me an email to blog.istomesmo @ gmail.com that I try to help.
Fevereiro 13th, 2008 at 1:00 February 13th, 2008 at 1:00
Salvou a minha vida! Saved my life! tinha baixado só o SQL express edition e não sabia o que fazer… obrigado fell only SQL Express Edition and did not know what to do ... thanks