如何删除服务器上的数据集
⑴ supermap iDesktop 处理数据集及生成场景缓存
一些相关视频资料
SuperMap iClient3D for WebGL开发准备: http://support.supermap.com.cn/proct/VedioPlay.aspx?id=189
三维性能优化方法与策略: http://support.supermap.com.cn/proct/VedioPlay.aspx?id=289
注:以下操作均基于SuperMap iDesktop 9D(.NET)版,不同版本菜单及界面稍有不同。
一、数据源处理
1、点击菜单栏 【开始】→【打开】→【数据源】→选择数据源文件(UDB格式)
2、数据集类型转换: CAD 数据集转换为简单数据集或模型数据集,转换为这2种格式后面才能正常生成场景缓存 。如果数据集本身已经是简单数据集或模型数据集,可跳过这一步。
左键选中需要转换的数据集 →点击菜单栏【数据】→【类型转换】→选择【CAD->简单】或【CAD->模型】
如果选择转换为简单数据源,将弹出以下界面,选择需要转换的源数据(包括数据源及数据集),点击转换即可。
如果选择转换为模型数据集,将弹出以下界面,直接点击转换即可( 如果这个界面没有显示数据,需点击添加源数据按钮手动添加数据 ,因为supermap会默认转换当前选中的数据集,如果点击类型转换前没有选中数据集将会出现界面无数据的情况)。
转换成功后的数据集(这个步骤耗时会比较长,需要耐心等,这里我选择转换成模型数据集)
二、数据优化(含 BIM 简化、移除重复点等)
当需要加载的数据非常大时,即使配置的独显再好,也难免出现卡顿掉帧现象。为了提高渲染速度,优化渲染帧率,可进行BIM简化、移除重复点等操作。
1、添加数据集到球面场景中
点击工作空间管理器中的【场景】→【新建球面场景】→将上一步转换成功的简单或模型数据集拖入新建的球面场景中
2、BIM简化
菜单栏点击【对象操作】→【BIM模型】→点击【BIM简化】
在弹出来的BIM简化菜单中,可以选择是对选中对象还是所有对象进行BIM简化操作,同时根据需求设定简化率,简化率越高,简化后的模型越粗糙,加载速度越快( 模型是由许多三角面组成的,三角面数越多,模型越精细,BIM简化其实是过滤三角面数的一个过程,所以简化后的模型会比原始模型粗糙,对模型精细度有高要求的建议不要进行这步操作 )。
拖动简化信息下的简化率后会自动开始BIM简化,完成后点击保存。可以查看场景中简化前及简化后的帧率信息,可以明显看到平均帧率提升了,三角面数量也减少了。
帧率信息在场景的左下方可以看到,一般默认都是未开启的,开启步骤:场景中右键→点击【属性】→弹出的场景属性面板中勾选【帧率信息】
3、移除重复点
重新新建一个球面场景,将上面进行了BIM简化的数据集拖到新建的球面场景中。
点击菜单栏【BIM模型】→【移除重复点】
在弹出的移除重复点界面中,可选择移除的范围(所有对象或选中对象)和进行参数设置,设置完毕后点击另存即可。 进行移除重复点主要是移除一些重复的模型数据,例如场景中有许多相同的车子模型,他们除了空间位置信息外,其它的模型数据都相同,那么实际上只需要保存一份模型数据,然后在不同位置多次绘制即可。
输出窗口信息,成功移除重复点134个。
三、三维模型数据转二维面数据
如果项目中有查看二维平面图或实现二三维地图联动效果的需求,就需要把三维模型数据集转换为二维面数据,进而转换为二维平面地图。如果项目不涉及到二维数据可跳过这一步。
1、生成二维面数据
左键选中要转换的三维模型数据集→点击菜单栏【数据】→【类型转换】→【模型->二维面】
在弹出的模型数据->二维面数据菜单中,选择要转换的模型数据集,点击转换即可,转换需要比较长的时间,具体视电脑配置及数据集数据大小而定。
生成二维面数据集后,双击数据集打开如下
2、编辑二维面数据
默认生成的二维数据集是不允许编辑的,如果要对数据集进行删除、移动等操作,点击菜单栏【地图】→【图层属性】
在弹出的图层属性界面中,勾选【编辑】,就可以在主窗口中对二维面数据进行删除、移动等操作了。
3、保存为地图
二维数据需以地图形式进行数据发布,直接在主窗口中右键→点击【保存地图】即可
四、生成场景缓存
当所有的数据处理完毕后,需要对处理好的数据进行生成场景缓存操作,如果不生成场景缓存,对于如此大的数据量,浏览器直接加载很容易导致卡顿甚至奔溃,加载速度也不理想。
选中最终处理后的数据集→右键→生成场景缓存
在弹出的生成场景缓存界面中,缓存类型选择OSGB,文件类型选择S3M,瓦片边长、LOD层数、LOD层级对应的网格简化率可以使用默认值,如果项目需要也可以根据需求更改,设置完毕后点击生成。
生成的场景缓存数据会默认保存到当前工作空间所在的目录
至此,supermap iDesktop 处理数据和生成场景缓存的所有步骤就结束了,接下来只需要把这些数据发布到服务器即可。生成的数据如何发布详见写的另一篇文章: supermap iServer 发布地图及数据服务
五、前端加载场景缓存
⑵ 重复数据删除是什么意思
尽管重复删除技术已经逐渐成为一项热门技术,但是很多分析师和用户都提出,要谨慎的对待它,不要因为广告大肆宣传而盲目追捧。
重复数据删除技术旨在删除冗余的备份数据、确保同样的数据信息只被保存一次。最近,众多厂商都相继推出了整合该技术特性的解决方案。与此同时,一些用户也开始使用这项技术来对海量数据进行管理与控制。
其他一些潜在的用户在面对五花八门的重复数据删除方案时也显得有些无所适从。在这里,专家为用户列出了以下几条建议:
1、详细了解这项技术。尽管现在关于重复数据删除技术的宣传铺天盖地,但这并不意味着这项技术适合所有用户应用。StorageIO顾问公司的分析师Greg Schulz表示:“重复数据删除并不是删除冗余数据的唯一方法。”他还说,用户可以考虑采用其他一些管理、简化数据的技术。
在这里,他特别提到Storewiz等厂商所提供的数据压缩技术。他说:“数据压缩技术的数据删除率比重复数据删除低,但是前者的数据删除率要比后者稳定的多。”所以在通常情况下,数据压缩技术的可靠性更高。
Storewiz提供的数据压缩技术不仅可以删除冗余的备份数据,而且可以删除冗余的主存储器。与重复数据20:1到50:1之间的数据压缩率相比,Storewiz的数据压缩技术的压缩率则在2:1到5:1之间(取决于数据和应用程序的类型)。
2、明确你的需求是什么。在应用重复数据删除技术之前,用户应该认真地想一想自己到底需要这项技术来实现什么目标。“重复数据删除的条件就是存在相同或者类似的信息。”Schulz这样说道,例如姓名或地址等相同的数据信息很容易被重复数据删除技术列为要删除或压缩的对象。
3、选择一个合适的、带有重复数据删除功能的解决方案。目前,各厂商在其硬件或软件产品中提供了形式多样的重复数据删除技术策略。例如,Data Domain和Quantum推出了一种专门的重复数据应用,而归属于EMC的Asigra和Avamar则推出了一种基于软件的解决方案。此外,FalconStor和Sepaton等厂商还提供了一种为删除的冗余数据创建VTL的解决方案。
DragonSlayer咨询公司的首席分析师Marc Staimer说:“我个人更倾向于将重复数据删除技术整合加入到软件产品中的解决方案,这样我就可以自己决定使用哪一款软件。”他认为VTL和基于应用的重复数据删除都是有局限性的。“它限制了操作的灵活性,也就是说,如果我采用了其他厂商提供的VTL,就会带来许多问题,”
4、Inline processing与Post processing。重复数据删除技术被分为两大类:Domain、Diligent等提供的Inline processing和由Sepaton、FalconStor等提供的Post processing。目前,只有昆腾能够在一个解决方案中既提供Inline processing技术又提供Post processing技术。
Inline processing发生在数据从备份服务器接收并存储到磁盘的时候,而Post processing通常发生在备份处理之后,避免了备份和重复数据删除之间发生冲突。目前,支持Inline processing和Post processing的两大阵营不分上下,但是又有第三个阵营表示更倾向于将Inline processing和Post processing相互整合。
虽然Post processing技术不会减缓数据备份的处理过程,但是Post processing更适合那些大型企业,因为通常这些大型企业可以为那些还没有被删除的冗余数据提供富余的存储空间。
5、提前考虑到安全问题。教育服务提供商Timecruiser的CTO James Wang认为,由于重复数据强调的是单实例存储,所以这给用户带来了新的安全问题。他说:“如果你执行了重复数据删除,数据信息的多个副本都会被删除,最后只保留一个副本,于是你就不得不格外谨慎地保留这个副本。”
之前,Timecruiser每天都会保存当天所有的数据副本,而现在它只保存其中的一部分了。为了增强安全性,Wang和他的技术小组正研究向其重复数据删除的基础架构中整合加入远程复制功能,将公司的数据信息复制到一台远地的存储设备上。
⑶ 怎么查看和修改Oracle数据库服务器端的字符集
查看的话可以这样:
select userenv(‘language’) from al
修改:
sql>conn / as sysdba; 若此时数据库服务器已启动,则先执行SHUTDOWN IMMEDIATE命令关闭数据库服务器,然后执行以下命令:
SQL>STARTUP MOUNT;
SQL>ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL>ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL>ALTER SYSTEM SET AQ_TM_PROCESSES=0;
SQL>ALTER DATABASE OPEN;
SQL>ALTER DATABASE CHARACTER SET ZHS16GBK;
SQL>ALTER DATABASE national CHARACTER SET ZHS16GBK;
SQL>SHUTDOWN IMMEDIATE;
SQL>STARTUP
⑷ 调用数据库的问题
新建一个数据集-----连接数据库!---绑定表格-----Dataset1.xsd
private void Form1_Load(object sender, System.EventArgs e)
{
for(int i = dataGrid1.Controls.Count -1;i>=0;i--)//循环表格
{
Control ctr = dataGrid1.Controls[i];
if(ctr is DataGridTextBox)//删除表格中的单元格
{
dataGrid1.Controls.RemoveAt(i);//删除
}
}
sqlDataAdapter1.Fill(this.dataset11.Flight);
}
private Dataset1.FlightRow currentRow;
private void dataGrid1_CurrentCellChanged(object sender, System.EventArgs e)//表格改变事件CurrentCellChanged
{
this.dataGrid1.Select(dataGrid1.CurrentRowIndex);//选中整行
DataRowView view=(DataRowView)this.BindingContext//绑定数据行视图[dataset11,"Flight"].Current;
currentRow=(Dataset1.FlightRow)view.Row;
this.txtcode.Text=currentRow.FlightCode;//选中的行在文本框中显示
this.txtstart.Text=currentRow.Source;
this.txtover.Text=currentRow.Destination;
}
--------------------完整的例子--------------------------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Flight
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.TextBox txtcode;
private System.Windows.Forms.TextBox txtstart;
private System.Windows.Forms.TextBox txtover;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
private System.Data.SqlClient.SqlConnection conn;
private Flight.Dataset1 dataset11;
private System.Windows.Forms.DataGridTableStyle dataGridTableStyle1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn2;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn4;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataset11 = new Flight.Dataset1();
this.dataGridTableStyle1 = new System.Windows.Forms.DataGridTableStyle();
this.dataGridTextBoxColumn1 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn2 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn4 = new System.Windows.Forms.DataGridTextBoxColumn();
this.txtcode = new System.Windows.Forms.TextBox();
this.txtstart = new System.Windows.Forms.TextBox();
this.txtover = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.conn = new System.Data.SqlClient.SqlConnection();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataset11)).BeginInit();
this.SuspendLayout();
//
// dataGrid1
//
this.dataGrid1.DataMember = "Flight";
this.dataGrid1.DataSource = this.dataset11;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(8, 8);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.ReadOnly = true;
this.dataGrid1.SelectionForeColor = System.Drawing.Color.Brown;
this.dataGrid1.Size = new System.Drawing.Size(312, 208);
this.dataGrid1.TabIndex = 0;
this.dataGrid1.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] {
this.dataGridTableStyle1});
this.dataGrid1.Navigate += new System.Windows.Forms.NavigateEventHandler(this.dataGrid1_Navigate);
this.dataGrid1.CurrentCellChanged += new System.EventHandler(this.dataGrid1_CurrentCellChanged);
//
// dataset11
//
this.dataset11.DataSetName = "Dataset1";
this.dataset11.Locale = new System.Globalization.CultureInfo("en-US");
//
// dataGridTableStyle1
//
this.dataGridTableStyle1.DataGrid = this.dataGrid1;
this.dataGridTableStyle1.GridColumnStyles.AddRange(new System.Windows.Forms.DataGridColumnStyle[] {
this.dataGridTextBoxColumn1,
this.dataGridTextBoxColumn2,
this.dataGridTextBoxColumn4});
this.dataGridTableStyle1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGridTableStyle1.MappingName = "Flight";
//
// dataGridTextBoxColumn1
//
this.dataGridTextBoxColumn1.Format = "";
this.dataGridTextBoxColumn1.FormatInfo = null;
this.dataGridTextBoxColumn1.HeaderText = "航班号";
this.dataGridTextBoxColumn1.MappingName = "FlightCode";
this.dataGridTextBoxColumn1.Width = 75;
//
// dataGridTextBoxColumn2
//
this.dataGridTextBoxColumn2.Format = "";
this.dataGridTextBoxColumn2.FormatInfo = null;
this.dataGridTextBoxColumn2.HeaderText = "起点";
this.dataGridTextBoxColumn2.MappingName = "Source";
this.dataGridTextBoxColumn2.Width = 75;
//
// dataGridTextBoxColumn4
//
this.dataGridTextBoxColumn4.Format = "";
this.dataGridTextBoxColumn4.FormatInfo = null;
this.dataGridTextBoxColumn4.HeaderText = "终点";
this.dataGridTextBoxColumn4.MappingName = "Destination";
this.dataGridTextBoxColumn4.Width = 75;
//
// txtcode
//
this.txtcode.Location = new System.Drawing.Point(336, 24);
this.txtcode.Name = "txtcode";
this.txtcode.Size = new System.Drawing.Size(168, 21);
this.txtcode.TabIndex = 1;
this.txtcode.Text = "";
//
// txtstart
//
this.txtstart.Location = new System.Drawing.Point(336, 72);
this.txtstart.Name = "txtstart";
this.txtstart.Size = new System.Drawing.Size(168, 21);
this.txtstart.TabIndex = 2;
this.txtstart.Text = "";
//
// txtover
//
this.txtover.Location = new System.Drawing.Point(336, 120);
this.txtover.Name = "txtover";
this.txtover.Size = new System.Drawing.Size(168, 21);
this.txtover.TabIndex = 3;
this.txtover.Text = "";
//
// button1
//
this.button1.Location = new System.Drawing.Point(344, 152);
this.button1.Name = "button1";
this.button1.TabIndex = 4;
this.button1.Text = "添加";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(344, 192);
this.button2.Name = "button2";
this.button2.TabIndex = 5;
this.button2.Text = "删除";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(432, 152);
this.button3.Name = "button3";
this.button3.TabIndex = 6;
this.button3.Text = "修改";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(432, 192);
this.button4.Name = "button4";
this.button4.TabIndex = 5;
this.button4.Text = "退出";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Flight", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("FlightCode", "FlightCode"),
new System.Data.Common.DataColumnMapping("Source", "Source"),
new System.Data.Common.DataColumnMapping("Destination", "Destination")})});
this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = "DELETE FROM Flight WHERE (FlightCode = @Original_FlightCode) AND (Destination = @" +
"Original_Destination OR @Original_Destination IS NULL AND Destination IS NULL) A" +
"ND (Source = @Original_Source OR @Original_Source IS NULL AND Source IS NULL)";
this.sqlDeleteCommand1.Connection = this.conn;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_FlightCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "FlightCode", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Destination", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Destination", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Source", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Source", System.Data.DataRowVersion.Original, null));
//
// conn
//
this.conn.ConnectionString = "workstation id=PC210;packet size=4096;integrated security=SSPI;initial catalog=Ai" +
"r;persist security info=False";
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO Flight(FlightCode, Source, Destination) VALUES (@FlightCode, @Source," +
" @Destination); SELECT FlightCode, Source, Destination FROM Flight WHERE (Flight" +
"Code = @FlightCode)";
this.sqlInsertCommand1.Connection = this.conn;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@FlightCode", System.Data.SqlDbType.VarChar, 10, "FlightCode"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Source", System.Data.SqlDbType.VarChar, 50, "Source"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Destination", System.Data.SqlDbType.VarChar, 50, "Destination"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT FlightCode, Source, Destination FROM Flight";
this.sqlSelectCommand1.Connection = this.conn;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE Flight SET FlightCode = @FlightCode, Source = @Source, Destination = @Destination WHERE (FlightCode = @Original_FlightCode) AND (Destination = @Original_Destination OR @Original_Destination IS NULL AND Destination IS NULL) AND (Source = @Original_Source OR @Original_Source IS NULL AND Source IS NULL); SELECT FlightCode, Source, Destination FROM Flight WHERE (FlightCode = @FlightCode)";
this.sqlUpdateCommand1.Connection = this.conn;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@FlightCode", System.Data.SqlDbType.VarChar, 10, "FlightCode"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Source", System.Data.SqlDbType.VarChar, 50, "Source"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Destination", System.Data.SqlDbType.VarChar, 50, "Destination"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_FlightCode", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "FlightCode", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Destination", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Destination", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Source", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Source", System.Data.DataRowVersion.Original, null));
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(528, 229);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.txtover);
this.Controls.Add(this.txtstart);
this.Controls.Add(this.txtcode);
this.Controls.Add(this.dataGrid1);
this.Controls.Add(this.button4);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataset11)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button4_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
private void Form1_Load(object sender, System.EventArgs e)
{
for(int i = dataGrid1.Controls.Count -1;i>=0;i--)
{
Control ctr = dataGrid1.Controls[i];
if(ctr is DataGridTextBox)
{
dataGrid1.Controls.RemoveAt(i);
}
}
sqlDataAdapter1.Fill(this.dataset11.Flight);
}
private Dataset1.FlightRow currentRow;
private void dataGrid1_CurrentCellChanged(object sender, System.EventArgs e)
{
this.dataGrid1.Select(dataGrid1.CurrentRowIndex);//选中整行
DataRowView view=(DataRowView)this.BindingContext[dataset11,"Flight"].Current;
currentRow=(Dataset1.FlightRow)view.Row;
this.txtcode.Text=currentRow.FlightCode;
this.txtstart.Text=currentRow.Source;
this.txtover.Text=currentRow.Destination;
}
private void button3_Click(object sender, System.EventArgs e)
{
currentRow.FlightCode=this.txtcode.Text;
currentRow.Source=this.txtstart.Text;
currentRow.Destination= this.txtover.Text;
sqlDataAdapter1.Update(this.dataset11.Flight);
}
private void button1_Click(object sender, System.EventArgs e)
{
DataRow newrow = dataset11.Tables[0].NewRow();
newrow[0]=this.txtcode.Text;
newrow[1]=this.txtstart.Text;
newrow[2]=this.txtover.Text;
dataset11.Flight.Rows.Add(newrow);
sqlDataAdapter1.Update(this.dataset11.Flight);
}
private void button2_Click(object sender, System.EventArgs e)
{
currentRow.Delete();
sqlDataAdapter1.Update(this.dataset11.Flight);
MessageBox.Show("删除成功!!!");
}
private void dataGrid1_Navigate(object sender, System.Windows.Forms.NavigateEventArgs ne)
{
}
}
}
----------------------------数据库--------------------------------
create database Air
go
use Air
go
create table Flight
(
FlightCode varchar(10) primary key,
Source varchar(50),
Destination varchar(50)
)
go
insert into Flight values('AF0001','厦门','上海')
insert into Flight values('BH8888','厦门','北京')
insert into Flight values('DR8988','北京','上海')
insert into Flight values('UI6766','福州','上海')
insert into Flight values('FG5432','北京','西安')
insert into Flight values('QW4555','兰州','上海')
insert into Flight values('ES4333','北京','成都')
insert into Flight values('NB5666','南昌','上海')
select * from Flight
-----------------------还要建设一个数据集----------------
选择项目---添加新建项-----数据集(不要改名)---从服务器资源管理器(左边的数据库)把上面的表格拉到里面搞定!!!
⑸ dw中怎样删除与子网站无关的其他mysql数据
1.建立站点
2.设置好数据库
3.设置好odbc
4.建立dreamweaver与数据库的连接
5.使用网络服务器软件,设置好运行环境,以便以后预览网页。
6.建立数据集
完成这些,就可以使用了。
⑹ 怎样删除数据库中的表而不产生日志
--只能做最小日志记录
alter database 库名 set recovery simple
--然后删除记录
--删除完成后恢复设置
alter database 库名 set recovery full
⑺ intel快速存储技术怎么卸载
intel快速存储是不能卸载的。
如果不想它启动,可以到计算机--管理--服务和应用程序--服务,找到英特尔 快速存储技术,然后右键点击关闭即可。
⑻ 只修改多表连接的数据集中一个表的数据
在 ADO.NET 数据集中浏览多个相关表
以下对象用于表达数据集中的关系:
DataSet - 在内存中表示数据,可以包含多个可与 DataRelation 对象相关的 DataTable 对象。有关详细信息,请参阅 Introction to Datasets。
DataTable - 表示一个完整的数据表。数据表的架构是由构成该表的 DataColumnCollection 定义的。当两个数据表相关时,DataRelation 对象使用每个表中的 DataColumn 来关联数据。有关详细信息,请参阅 Creating and Using DataTables。
DataRelation - 连接多个表,以便浏览相关表中的记录。访问相关记录时,DataRelation 对象被传递给 GetChildRows 或 GetParentRow 方法。DataRelation 对象确定所要查询的相关表,以便返回与 GetChildRows 或 GetParentRow 方法调用相关联的相关数据。有关详细信息,请参阅 Introction to DataRelation Objects。
DataRow - 表示数据的一个单独的记录。用于返回相关数据的 GetChildRows 方法和 GetParentRow 方法是 DataRow 对象的成员。
DataColumn - 表示一个单独的字段,结合在一起时将定义 DataTable 的架构。当两个数据表相关时,DataRelation 对象使用每个表中的数据列来关联数据。
创建应用程序
本节将建立这一演练的起点。随后的步骤将创建数据连接、数据适配器和包含相关表的数据集,以及几个选择和显示数据的控件。
创建新的 Windows 应用程序
从 File(文件)菜单中,指向 New(新建),并选择 Project(项目)。将显示 New Project(新建项目)对话框。
在 Project Types(项目类型)窗格中,根据您需要的编程语言,选择 Visual Basic Projects(Visual Basic 项目)或 Visual C# Projects(Visual C# 项目)。
在 Templates(模板)窗格中,选择 Windows Application(Windows 应用程序),并将其命名为 DataRelationExample,然后单击 OK(确定)。
DataRelationExample 项目将添加到 Solution Explorer(解决方案资源管理器)中。
连接到数据库
此连接允许您与 Visual Studio® 集成开发环境 (IDE) 中的数据源进行通讯。
连接到 Server Explorer(服务器资源管理器)中的罗斯文示例数据库
在 Server Explorer(服务器资源管理器)中,建立连接到罗斯文示例数据库的数据连接。有关详细信息,请参阅 Adding New Data Connections in Server Explorer。
在 Server Explorer(服务器资源管理器)中展开罗斯文数据连接,直到可以看到所有的表。
创建数据适配器和连接
此步骤创建用于在应用程序和数据源之间连接和交换数据的连接和数据适配器。
创建数据适配器和连接
将“客户”表从 Server Explorer(服务器资源管理器)中拖到窗体上。组件栏中将显示连接和数据适配器。
选择 Connection(连接)并将 Name 属性设置为 dcNorthwind。
选择数据适配器并将 Name 属性设置为 daCustomers。
将“订单”表从 Server Explorer(服务器资源管理器)中拖到窗体上。组件栏中将显示第二个数据适配器。
选择新的数据适配器并将 Name 属性设置为 daOrders。
生成数据集
使用刚刚添加到窗体上的数据适配器生成包含客户表和订单表的数据集。
生成将包含相关数据表的数据集
从 Data(数据)菜单中,选择 Generate Dataset(生成数据集)。将显示 Generate Dataset(生成数据集)对话框。
提示:将光标移到窗体上即可使用 Data(数据)菜单。
单击 New(新建)并将数据集命名为 dsNorthwind。
选择客户表和订单表。
选择 Add this dataset to the designer(将此数据集添加到设计器)复选框,然后单击 OK(确定)。
Solution Explorer(解决方案资源管理器)的项目中将添加一个名为 dsNorthwind.xsd 的文件,并且组件栏中将显示该数据集的一个实例。
创建关系
生成数据集并不能自动创建数据集中各表之间的关系。关系可以通过编程创建,也可以使用 XML Designer(XML 设计器)直观地创建。本文使用 XML Designer(XML 设计器)。
创建客户表和订单表之间的关系
在 Solution Explorer(解决方案资源管理器)中,双击 dsNorthwind.xsd 文件。文件将在 XML Designer(XML 设计器)中打开。
从工具栏的 XML Schema(XML 架构)选项卡中,将 Relation(关系)拖到订单表上。
在 Edit Relation(编辑关系)对话框中,设置以下属性:元素 设置
Name CustomersOrders
Parent Customers
Child Orders
Key Fields CustomerID
Foreign Key Fields CustomerID
单击 OK(确定)以创建关系并关闭对话框。
从 File(文件)菜单中,选择 Save All(全部保存)以保存该项目。
显示数据
此应用程序使用组合框、列表框和 RTF 文本框来选择和显示数据。
添加选择和显示数据的控件
在 Solution Explorer(解决方案资源管理器)中,右键单击 Form1(.cs 或 .vb,取决于应用程序的语言),然后从快捷菜单中选择 View Designer(视图设计器)。
在窗体的左半部,添加一个 ListBox 控件,并将其 Name 属性设置为 lbOrders。
在窗体的右半部,添加一个 RichTextBox 控件,并将其 Name 属性设置为 rtbDetails。
在列表框的上方,添加一个 ComboBox 控件,并将其 Name 属性设置为 cbCustomers。
保存项目。
图 1:建议的窗体控件布局
现在,可以开始向应用程序添加功能了。
设置显示公司名称的组合框
选择组合框 (cbCustomers) 并设置以下属性:属性 设置
DataSource DsNorthwind1
DisplayMember Customers.CompanyName
ValueMember Customers.CustomerID
用数据填充表
要用数据填充表,必须为应用程序添加代码。
在数据集 (dsNorthwind1) 中的客户表和订单表中填充数据
双击窗体上的一块空白区域,为 Form1_Load 事件创建事件处理程序。
添加以下代码:
' Visual Basic
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
' 关闭数据集中的约束。
DsNorthwind1.EnforceConstraints = False
' 用数据填充表。
daOrders.Fill(DsNorthwind1)
daCustomers.Fill(DsNorthwind1)
' 重新开启约束。
DsNorthwind1.EnforceConstraints = True
End Sub
// C#
private void Form1_Load(object sender, System.EventArgs e)
{
// 关闭数据集中的约束。
dsNorthwind1.EnforceConstraints = false;
// 用数据填充表。
daOrders.Fill(dsNorthwind1);
daCustomers.Fill(dsNorthwind1);
// 重新开启约束。
dsNorthwind1.EnforceConstraints = true;
}
保存项目。
按 F5 键运行该应用程序。现在组合框中包含一个公司名称列表。
关闭窗体。
在两个表中浏览相关记录
这里简要介绍一下如何在数据集中构成一对多关系的两个表之间访问数据。在选择一个数据行之后,可以通过调用 GetChildRows 或 GetParentRow 方法并向该数据行传递适当的数据关系来返回其相关记录。
注意:GetChildRows 方法将以 DataRow 对象数组的形式返回数据,而 GetParentRow 方法只返回一个单个的数据行。
要演示这一功能,需要给应用程序添加一些代码,以返回组合框中选定客户的所有订单(子行)。更改组合框中的选定客户会引发 ComboBox.SelectedIndexChanged 事件,列表框中将填充该选定客户的每个订单的订单 ID。
您可以根据组合框中选定的客户,调用 GetChildRows 方法。订单表中的所有相关记录都将分配给名为 draOrders 的数据行数组。
注意:下一节将添加在列表框中显示相关订单列表的功能。为确认数组中确实包含相关的记录,数组的长度(即选定客户的订单总数)将显示为窗体的标题。
创建获取选定客户的订单的事件处理程序
在 Solution Explorer(解决方案资源管理器)中,右键单击 Form1 并从快捷菜单中选择 View Designer(视图设计器)。
双击组合框为 SelectedIndexChanged 事件创建事件处理程序。
添加以下代码:
' Visual Basic
Private Sub cbCustomers_SelectedIndexChanged _
(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles cbCustomers.SelectedIndexChanged
' 声明一个用来保存选定客户的客户 ID 的字符串。
Dim SelectedCustomerID As String
SelectedCustomerID = cbCustomers.SelectedValue.ToString()
' 声明一个用来保存选定客户的记录的数据行。
Dim drSelectedCustomer As DataRow
drSelectedCustomer = _
DsNorthwind1.Customers.FindByCustomerID _
(SelectedCustomerID)
' 声明一个用来保存相关记录的数据行数组。
Dim draOrders As DataRow()
draOrders = drSelectedCustomer.GetChildRows("CustomersOrders")
' 在窗体标题中显示数组的长度(订单数)
' 和客户 ID。
Me.Text = draOrders.Length.ToString() & " 订单所有者 " & _
SelectedCustomerID
End Sub
// C#
private void cbCustomers_SelectedIndexChanged
(object sender, System.EventArgs e)
{
// 声明一个用来保存选定客户的客户 ID 的字符串。
String SelectedCustomerID;
SelectedCustomerID = cbCustomers.SelectedValue.ToString();
// 声明一个用来保存选定客户的记录的数据行。
DataRow drSelectedCustomer;
drSelectedCustomer =
dsNorthwind1.Customers.FindByCustomerID(SelectedCustomerID);
// 声明一个用来保存相关记录的数据行数组。
DataRow[] draOrders;
draOrders = drSelectedCustomer.GetChildRows("CustomersOrders");
// 在窗体标题中显示数组的长度(订单数)
// 和客户 ID。
this.Text = draOrders.Length.ToString() +
" 订单所有者 " + SelectedCustomerID;
}
保存项目。
运行应用程序。
选择另一个客户,并检查窗体标题。将显示选定客户的订单总数及其客户 ID。
关闭窗体。
显示相关记录
现在您已经有了选定客户的相关记录(存储在数据行数组中),您可以显示它们以便与用户进行交互。应用程序将逐一访问 GetChildRows 方法返回的数据行数组中的数据,并将每个相关记录的“订单 ID”作为单独的项添加到列表框中。
注意:虽然此示例将逐一访问相关数据行数组中的数据,但列表框可能已经使用属性窗口,通过 DataSource 属性、DataMember 属性和 ValueMember 属性被绑定到相关的记录。
在列表框中显示相关记录
在 Solution Explorer(解决方案资源管理器)中,右键单击 Form1 并从快捷菜单中选择 View Code(查看代码)。
在前面步骤中创建的组合框的 SelectedIndexChanged 事件处理程序中,将以下代码添加到处理程序中已有代码之下:
' Visual Basic
' 当更改选定客户时,清除订单列表。
lbOrders.Items.Clear()
rtbDetails.Text = ""
' 将每个相关订单的订单 ID 添加到列表框中。
Dim drOrder As DataRow
For Each drOrder In draOrders
lbOrders.Items.Add(drOrder("OrderID"))
Next
// C#
// 当更改选定客户时,清除订单列表。
lbOrders.Items.Clear();
rtbDetails.Text = "";
// 将每个相关订单的订单 ID 添加到列表框中。
foreach(DataRow drOrder in draOrders)
{
lbOrders.Items.Add(drOrder["OrderID"]);
}
保存项目。
运行应用程序。
列表框中将显示订单列表。在组合框中选择另一个客户,订单列表将被更新。
关闭窗体。
在三个或更多表中浏览相关记录
浏览三个或更多表与处理两个表一样简单。要了解如何处理两个以上的表,请将订单明细表和产品表添加到
dsNorthwind
数据集中。在列表框中选定一个订单后,该订单的详细信息即显示在 RTF 文本框中。
为了满足约束规则,您需要删除现有的数据关系,将来再重新创建。
暂时删除 dsNorthwind 数据集中的 DataRelation
在 Solution Explorer(解决方案资源管理器)中,双击 dsNorthwind.xsd 以在 XML Designer(XML 设计器)中打开它。
选择现有的 CustomersOrders 关系并将其删除。
保存项目。
现在您需要将另外两个表添加到现有数据集中,并创建新的 DataRelation 对象以将所有表连在一起。
将订单明细表和产品表添加到 dsNorthwind 数据集中
在 Solution Explorer(解决方案资源管理器)中,右键单击 Form1 并从快捷菜单中选择 View Designer(视图设计器)。
将“订单明细”表从 Server Explorer(服务器资源管理器)中拖到窗体上。组件栏中将显示一个新的数据适配器。
选择该新的数据适配器并将其 Name 属性设置为 daOrderDetails。
将“产品”表从 Server Explorer(服务器资源管理器)中拖到窗体上。组件栏中将显示一个新的数据适配器。
选择该新的数据适配器并将其 Name 属性设置为 daProcts。
新表只是被添加到了窗体上,因此每次添加额外的表时,都必须重新生成数据集。
重新生成 dsNorthwind 数据集
从 Data(数据)菜单中,选择 Generate Dataset(生成数据集)。
提示:将光标移到窗体上即可使用 Data(数据)菜单。
单击 Existing(现有),然后选择 dsNorthwind 数据集。
选择所有四个表(客户表、订单表、订单明细表和产品表)。
清除 Add this dataset to the designer(将此数据集添加到设计器)复选框,然后单击 OK(确定)。将生成带有附加表的数据集。
注意:如果出现一个对话框,其中说明“The file has been modified outside of the source editor. Do you want to reload it?”(文件已在源编辑器之外被修改。是否要重新加载?),请单击 Yes(是)。
请记住,生成数据集并不能自动创建数据集中各表之间的关系。
创建关系
在 Solution Explorer(解决方案资源管理器)中,双击 dsNorthwind.xsd 文件。文件将在 XML Designer(XML 设计器)中打开。
从工具栏的 XML Schema(XML 架构)选项卡中,将 Relation(关系)拖到订单表上。
在 Edit Relation(编辑关系)对话框中,设置以下属性:元素 设置
Name CustomersOrders
Parent Customers
Child Orders
Key Fields CustomerID
Foreign Key Fields CustomerID
单击 OK(确定)以创建关系并关闭对话框。
从工具栏的 XML Schema(XML 架构)选项卡中,将 Relation(关系)拖到订单明细表上。
在 Edit Relation(编辑关系)对话框中,设置以下属性:元素 设置
Name OrdersOrderDetails
Parent Orders
Child OrderDetails
Key Fields OrderID
Foreign Key Fields OrderID
单击 OK(确定)以创建关系并关闭对话框。
从工具栏的 XML Schema(XML 架构)选项卡中,将 Relation(关系)拖到订单明细表上。
在 Edit Relation(编辑关系)对话框中,设置以下属性:元素 设置
Name ProctsOrderDetails
Parent Procts
Child OrderDetails
Key Fields ProctID
Foreign Key Fields ProctID
单击 OK(确定)以创建关系并关闭对话框。
保存项目。
订单明细表和产品表已被添加到数据集中,但是您仍需要添加代码,以便在运行时用数据来填充它们。
用数据填充表
在 Solution Explorer(解决方案资源管理器)中,右键单击 Form1 并从快捷菜单中选择 View Code(查看代码)。
在 Form1_Load 事件处理程序中,将以下代码添加到注释“
用数据填充表
”与
daOrders.Fill(dsNorthwind1)
行之间:
' Visual Basic
daOrderDetails.Fill(dsNorthwind1)
daProcts.Fill(dsNorthwind1)
// C#
daOrderDetails.Fill(dsNorthwind1);
daProcts.Fill(dsNorthwind1);
用数据填充 RTF 文本框
现在您要为项目添加代码,以便在列表框中选定某个订单时,可以在 RTF 文本框中显示所有订单明细。
以下代码将基于列表框中的选定订单调用 GetChildRows 方法。订单明细表中的所有相关记录都将分配给名为
draOrderDetails
的数据行数组。每个数据行的内容将显示在 RTF 文本框中。
注意:请注意嵌套的 For Each 循环是如何首先选取一个数据行,然后在该数据行的所有列中循环以访问整个相关记录的。
设置 RTF 文本框以显示所有订单明细
在 Solution Explorer(解决方案资源管理器)中,右键单击 Form1 并从快捷菜单中选择 View Designer(视图设计器)。
双击列表框为列表框 lbOrders 的 SelectedIndexChanged 事件创建事件处理程序。
添加以下代码:
' Visual Basic
Private Sub lbOrders_SelectedIndexChanged _
(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles lbOrders.SelectedIndexChanged
' 选择新订单时,清除 RTF 文本框。
rtbDetails.Clear()
' 声明一个用来保存选定的订单 ID 的整数。
Dim SelectedOrderID As Integer
' 将选定的项目设置为整数。
SelectedOrderID = CType(lbOrders.SelectedItem, Integer)
' 声明一个用来保存选定订单的记录的数据行。
Dim drSelectedOrder As DataRow
drSelectedOrder = _
DsNorthwind1.Orders.FindByOrderID(SelectedOrderID)
' 声明一个用来保存相关记录的数据行数组。
Dim draOrderDetails() As DataRow
draOrderDetails = _
drSelectedOrder.GetChildRows("OrdersOrderDetails")
Dim details As String = ""
Dim drDetails As DataRow
Dim dcDetails As DataColumn
For Each drDetails In draOrderDetails
For Each dcDetails In drDetails.Table.Columns
details &= dcDetails.ColumnName & ": "
details &= drDetails(dcDetails).ToString()
details &= ControlChars.CrLf
Next
details &= ControlChars.CrLf
Next
rtbDetails.Text = details
End Sub
// C#
private void lbOrders_SelectedIndexChanged
(object sender, System.EventArgs e)
{
// 选择新订单时,清除 RTF 文本框。
rtbDetails.Clear();
// 声明一个用来保存选定的订单 ID 的整数。
int SelectedOrderID;
// 将选定的项目设置为整数。
SelectedOrderID = (int)lbOrders.SelectedItem;
// 声明一个用来保存选定订单的记录的数据行。
DataRow drSelectedOrder;
drSelectedOrder =
dsNorthwind1.Orders.FindByOrderID(SelectedOrderID);
// 声明一个用来保存相关记录的数据行数组。
DataRow[] draOrderDetails;
draOrderDetails =
drSelectedOrder.GetChildRows("OrdersOrderDetails");
string details = "";
foreach(DataRow drDetails in draOrderDetails)
{
foreach(DataColumn dcDetails in drDetails.Table.Columns)
{
details += dcDetails.ColumnName + ": ";
details += drDetails[dcDetails].ToString() + "\n";
}
details += "\n";
}
rtbDetails.Text = details;
}
保存项目。
运行应用程序。
在列表框中选择一个订单,其订单明细将显示在 RTF 文本框中。
在列表框中选择另一个订单。RTF 文本框中的订单明细将被更新。
浏览多对多关系
构成多对多关系的表通常通过保证数据完整性的第三方表进行连接。在罗斯文数据库中,订单表和产品表就是这样相关的。因为有些订单可能包含很多产品,而有些产品又在很多订单中销售。这两个表是通过订单明细表连接的,订单明细表利用这两个表中的列建立自己特定的列,并使这些数据相关。浏览构成多对多关系的三个表与处理一对多关系的表并没有太大区别。
http://www.microsoft.com/china/MSDN/library/archives/library/dv_vstechart/html/.asp
⑼ 如何查看和修改Oracle数据库服务器端的字符集
Oracle数据库查看和修改服务器端的字符集的方法是本文主要要介绍的内容,接下来救让我们一起来了解一下这部分内容。
A、oracle server 端字符集查询
select userenv('language') from al
其中NLS_CHARACTERSET 为server端字符集
NLS_LANGUAGE 为 server端字符显示形式
B、查询oracle client端的字符集
$echo $NLS_LANG
如果发现你select 出来的数据是乱码,请把client端的字符集配置成与linux操作系统相同的字符集。如果还是有乱码,则有可能是数据库中的数据存在问题,或者是oracle服务端的配置存在问题。
C、server端字符集修改
将数据库启动到RESTRICTED模式下做字符集更改:
SQL> conn /as sysdba Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount ORACLE instance started.
Total System Global Area 236000356 bytes
Fixed Size 451684 bytes
Variable Size 201326592 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
System altered.
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
System altered.
SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
System altered.
SQL> alter database open;
Database altered.
SQL> ALTER DATABASE CHARACTER SET ZHS16GBK;
ALTER DATABASE CHARACTER SET ZHS16GBK ERROR at line 1:
ORA-12712: new character set must be a superset of old character set
提示我们的字符集:新字符集必须为旧字符集的超集,这时我们可以跳过超集的检查做更改:
SQL> ALTER DATABASE character set INTERNAL_USE ZHS16GBK;
Database altered.
SQL> select * from v$nls_parameters;
略
19 rows selected.
重启检查是否更改完成:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup ORACLE instance started.
Total System Global Area 236000356 bytes
Fixed Size 451684 bytes
Variable Size 201326592 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> select * from v$nls_parameters;
略
19 rows selected.
我们看到这个过程和之前ALTER DATABASE CHARACTER SET操作的内部过程是完全相同的,也就是说INTERNAL_USE提供的帮助就是使Oracle数据库绕过了子集与超集的校验。
这一方法在某些方面是有用处的,比如测试;应用于产品环境大家应该格外小心,除了你以外,没有人会为此带来的后果负责。
结语(我们不妨再说一次):
对于DBA来说,有一个很重要的原则就是:不要把你的数据库置于危险的境地!
这就要求我们,在进行任何可能对数据库结构发生改变的操作之前,先做有效的备份,很多DBA没有备份的操作中得到了惨痛的教训。
D、client端字符集修改
在 /home/oracle与 /root用户目录下的。bash_profile中
添加或修改 export NLS_LANG="AMERICAN_AMERICA.UTF8" 语句
关闭当前ssh窗口。
注意:NLS_LANG变量一定要配置正确否则会引起sqlplus 失效。