Home Database Mysql Tutorial SQL Server数据库与其实际应用元数据介绍

SQL Server数据库与其实际应用元数据介绍

Jun 07, 2016 pm 04:17 PM
server actual application database

以下的文章主要是介绍SQL Server数据库与其实际应用元数据,我前两天在相关网站看见SQL Server数据库与其实际应用元数据的资料,觉得挺好,就拿出来供大家分享,希望会给大家带来一些帮助在此方面。 以下的文章主要是介绍SQL Server数据库与其实际应用元数据

以下的文章主要是介绍SQL Server数据库与其实际应用元数据,我前两天在相关网站看见SQL Server数据库与其实际应用元数据的资料,觉得挺好,就拿出来供大家分享,希望会给大家带来一些帮助在此方面。

以下的文章主要是介绍SQL Server数据库与其实际应用元数据,我前两天在相关网站看见SQL Server数据库与其实际应用元数据的资料,觉得挺好,就拿出来供大家分享,希望会给大家带来一些帮助在此方面。

我常被问到如何把驻留在物理服务器/SQL 实例上的SQL Server数据库转变为它们相应的应用程序名称。在准备计划好的服务器停机通知时,这种需要就产生了,,但在我的组织内与IT经理或非技术人员沟通时,这也是有价值的。如果你不是数据

我常被问到如何把驻留在物理服务器/SQL 实例上的数据库转变为它们相应的应用程序名称。在准备计划好的服务器停机通知时,这种需要就产生了,但在我的组织内与IT经理或非技术人员沟通时,这也是有价值的。

如果你不是数据库管理员或特定数据库的应用分析师,你通常会无视数据库的命名规则,而这些数据库支持着你每日依赖的应用程序。这就是为什么当需要产生时在适当的位置上由元数据库来提供转化很重要。

专家解答

大部分数据库管理员拥有某种形式的数据库元SQL Server数据库,他们依赖其来跟踪范围很广的Microsoft SQL Server环境。我利用连接的服务器和分布式数据库访问来建立一个已经在我的环境中使用了七年的元数据库。它不是漂亮的,但它是功能性很强的。

跟很多IT开发者和数据库管理员一样,即使它有自身的不足我还是为自己的创造感到骄傲。它很慢,不像它可以的那样最新型,也不像它应该的那样安全。

自从读了2007年5月和6月Rodney Landrum在SQL Server杂志上发表的关于SQL Server集成服务(SSIS)和数据库管理员知识库(DBA Repositories)的文章,我知道是时候采取别人的解决方法了。这对于我的环境来说是完美的,而一些改动也是容易采纳的。

2008年2月,一篇后续文章在SQL Server杂志上发表,在这篇文章里,Rodney更新了他的解决方法。我下载了代码,在我的测试环境里审核,并迅速把它纳入产品中。当大家普遍地为这个解决方法所提供的而感到高兴时,在它包中缺少的一方面是把数据库关联到应用程序的能力。

通过在他的解决方法中增加两张额外的表,我可以在我的“土生土长”元数据库中增加应用程序元数据到我现在使用的SQL Server杂志的方法中。

增加到我数据库中的应用元数据包括创建两张表:dbo.Applications,专为存储所有程序的应用名称,而这些程序在我的环境中依赖于SQL Server数据库,还有

dbo.Database_Applications,它保存SQL 实例、SQL Server数据库和应用程序之间的关系。

Applications Table CREATE TABLE [dbo].[Applications] (
[AppID] [int] IDENTITY(154,1) NOT NULL,
[ApplicationName] [varchar](100) NOT NULL, )
Database_Applications Table
CREATE TABLE [dbo].[Database_Applications] (
[DB_AppID] [int] IDENTITY(1,1) NOT NULL,
[ServerName] [varchar](50) NOT NULL,
[DatabaseName] [varchar](100) NOT NULL,
[ApplicationName] [varchar](100) NULL )

你可能注意到,我没有规范化dbo.Database_Applications表。如果我规范化,我会只存储两个区域:一个与存储我的应用元数据的表有关的外键,和一个与我的元数据库相对应的外键。我有自己的原因:

我没有处理大量的数据:我有大概800个数据库,这些SQL Server数据库在我的环境里发布80个实例。虽然这对于一个数据库管理员来说是个很大的环境,但是它既不转变成在我的元数据表里的大量纪录,也不转变成数据库的巨大字节。

不是通过dbo.Applications表的主键,而是包含表中的应用程序名,我可以通过只访问dbo.Database_Applications表产生我的主要应用程序元数据报告(key Application Metadata report)。

我的环境中的SQL元数据库使用“焦土政策”人口处理方法,除了SQL Agent Job History和Backup History,其他的表都被每天删除和重新载入。我发现在

dbo.Database_Applications表中保存信息可以使我的生活变得很容易。

每日从我的环境中载入数据后,我可以通过以下脚本得到在我的环境中产生的任何新的数据库的良好的陈述。

SELECT D.[Server], D.DatabaseName FROM dbo.Databases D LEFT JOIN dbo.Database_Applications DA ON D.DatabaseName = DA.DatabaseName AND D.[Server] = DA.[ServerName] WHERE DA.DB_AppID IS NULL ORDER BY D.[Server], D.DatabaseName

这个查询的结果提供任何数据库的清单,这些SQL Server数据库产生于上次我更新应用元数据和服务器时,它不仅是跨域的数据库创建活动的通知,也是致力于更新两个数据库来符合应用程序信息的数据清单。这个查询也适合SQL Server Reporting Services报告的数据表,而当我不在办公室时,SQL Server Reporting Services报告也为我提供了一个新的数据库到我的黑莓(BlackBerry)的日常通知。

最后,我创建了以下存储程序,由此用任何新的数据库信息来合并dbo.Applications表和dbo.Database_Applications 表。它接受三个参数:服务器,数据库和应用程序。如果应用程序已经不存在于dbo.Applications表中,它就会被补充。然后一个记录被插入到服务器/数据库/应用程序关系中的dbo.Applications表。

CREATE PROCEDURE [dbo].[pAdd_Application]
@ServerName varchar(50),
@DatabaseName varchar(100),
@ApplicationName varchar(100)
AS --Add any new databases created,
but not recorded in the repository, to the repository
UPDATE dbo.Database_Applications
SET ApplicationName = @ApplicationName
WHERE ServerName = @ServerName
AND DatabaseName = @DatabaseName
AND ApplicationName IS NULL
--Determine if there is already an application
for this database in the repository, if not, then add it
IF (SELECT COUNT(*) FROM dbo.Applications
WHERE ApplicationName = @ApplicationName) = 0
BEGIN INSERT INTO dbo.Applications (ApplicationName)
VALUES (@ApplicationName)
PRINT 'Added new Application: '
+ @ApplicationName + ' to Applications table'
SELECT * FROM dbo.Applications
WHERE ApplicationName = @ApplicationName
END --List the new record in the repository
SELECT ServerName, DatabaseName, ApplicationName
FROM dbo.Database_Applications
WHERE ServerName = @ServerName
AND DatabaseName = @DatabaseName
AND ApplicationName = @ApplicationName

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to Undo Delete from Home Screen in iPhone How to Undo Delete from Home Screen in iPhone Apr 17, 2024 pm 07:37 PM

Deleted something important from your home screen and trying to get it back? You can put app icons back on the screen in a variety of ways. We have discussed all the methods you can follow and put the app icon back on the home screen. How to Undo Remove from Home Screen in iPhone As we mentioned before, there are several ways to restore this change on iPhone. Method 1 – Replace App Icon in App Library You can place an app icon on your home screen directly from the App Library. Step 1 – Swipe sideways to find all apps in the app library. Step 2 – Find the app icon you deleted earlier. Step 3 – Simply drag the app icon from the main library to the correct location on the home screen. This is the application diagram

How does Go language implement the addition, deletion, modification and query operations of the database? How does Go language implement the addition, deletion, modification and query operations of the database? Mar 27, 2024 pm 09:39 PM

Go language is an efficient, concise and easy-to-learn programming language. It is favored by developers because of its advantages in concurrent programming and network programming. In actual development, database operations are an indispensable part. This article will introduce how to use Go language to implement database addition, deletion, modification and query operations. In Go language, we usually use third-party libraries to operate databases, such as commonly used sql packages, gorm, etc. Here we take the sql package as an example to introduce how to implement the addition, deletion, modification and query operations of the database. Assume we are using a MySQL database.

How does Hibernate implement polymorphic mapping? How does Hibernate implement polymorphic mapping? Apr 17, 2024 pm 12:09 PM

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

An in-depth analysis of how HTML reads the database An in-depth analysis of how HTML reads the database Apr 09, 2024 pm 12:36 PM

HTML cannot read the database directly, but it can be achieved through JavaScript and AJAX. The steps include establishing a database connection, sending a query, processing the response, and updating the page. This article provides a practical example of using JavaScript, AJAX and PHP to read data from a MySQL database, showing how to dynamically display query results in an HTML page. This example uses XMLHttpRequest to establish a database connection, send a query and process the response, thereby filling data into page elements and realizing the function of HTML reading the database.

Explore the advantages and application scenarios of Go language Explore the advantages and application scenarios of Go language Mar 27, 2024 pm 03:48 PM

The Go language is an open source programming language developed by Google and first released in 2007. It is designed to be a simple, easy-to-learn, efficient, and highly concurrency language, and is favored by more and more developers. This article will explore the advantages of Go language, introduce some application scenarios suitable for Go language, and give specific code examples. Advantages: Strong concurrency: Go language has built-in support for lightweight threads-goroutine, which can easily implement concurrent programming. Goroutin can be started by using the go keyword

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

See all articles